diff --git a/Makefile.in b/Makefile.in index b3a4c6312bcf..dc53fbb7002c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,7 +60,7 @@ ifndef MOZ_PROFILE_USE # We need to explicitly put backend.RecursiveMakeBackend.built here # otherwise the rule in rules.mk doesn't run early enough. default alldep all:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built - $(PYTHON) $(topsrcdir)/config/purge_directories.py -d _build_manifests/purge . + $(call py_action,purge_manifests,-d _build_manifests/purge .) endif CLOBBER: $(topsrcdir)/CLOBBER diff --git a/accessible/src/atk/Makefile.in b/accessible/src/atk/Makefile.in index 7255859e668c..70be75d8af48 100644 --- a/accessible/src/atk/Makefile.in +++ b/accessible/src/atk/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 -# we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk ifdef MOZ_ENABLE_GTK diff --git a/accessible/src/base/Makefile.in b/accessible/src/base/Makefile.in index 9fb53fca53f1..67191a4b573d 100644 --- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -11,9 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ diff --git a/accessible/src/generic/Makefile.in b/accessible/src/generic/Makefile.in index b2b938ed7058..68825db73f75 100644 --- a/accessible/src/generic/Makefile.in +++ b/accessible/src/generic/Makefile.in @@ -11,9 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/accessible/src/html/Makefile.in b/accessible/src/html/Makefile.in index 55b0f157172e..c73ec9317cf1 100644 --- a/accessible/src/html/Makefile.in +++ b/accessible/src/html/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index 664f52fefdee..9a015f0046e4 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -785,6 +785,8 @@ var Input = { B: ['movePrevious', 'Button'], c: ['moveNext', 'Combobox'], C: ['movePrevious', 'Combobox'], + d: ['moveNext', 'Landmark'], + D: ['movePrevious', 'Landmark'], e: ['moveNext', 'Entry'], E: ['movePrevious', 'Entry'], f: ['moveNext', 'FormElement'], diff --git a/accessible/src/jsat/OutputGenerator.jsm b/accessible/src/jsat/OutputGenerator.jsm index 0dc6fc93ef22..7fbff338f5a0 100644 --- a/accessible/src/jsat/OutputGenerator.jsm +++ b/accessible/src/jsat/OutputGenerator.jsm @@ -176,22 +176,12 @@ this.OutputGenerator = { * @param {nsIAccessible} aAccessible current accessible object. */ _addLandmark: function _addLandmark(aOutput, aAccessible) { - let getLandmarkName = function getLandmarkName(aAccessible) { - let roles = Utils.getAttributes(aAccessible)['xml-roles']; - if (!roles) { - return; - } - - // Looking up a role that would match a landmark. - for (let landmark of this.gLandmarks) { - if (roles.indexOf(landmark) > -1) { - return gStringBundle.GetStringFromName(landmark); - } - } - }; - - let landmark = getLandmarkName.apply(this, [aAccessible]); + let landmarkName = Utils.getLandmarkName(aAccessible); + if (!landmarkName) { + return; + } + let landmark = gStringBundle.GetStringFromName(landmarkName); if (!landmark) { return; } @@ -222,15 +212,6 @@ this.OutputGenerator = { return str.replace('#1', aCount); }, - gLandmarks: [ - 'banner', - 'complementary', - 'contentinfo', - 'main', - 'navigation', - 'search' - ], - roleRuleMap: { 'menubar': INCLUDE_DESC, 'scrollbar': INCLUDE_DESC, diff --git a/accessible/src/jsat/TraversalRules.jsm b/accessible/src/jsat/TraversalRules.jsm index e58f6e2f18cf..9473f56786c0 100644 --- a/accessible/src/jsat/TraversalRules.jsm +++ b/accessible/src/jsat/TraversalRules.jsm @@ -184,6 +184,14 @@ this.TraversalRules = { [ROLE_COMBOBOX, ROLE_LISTBOX]), + Landmark: new BaseTraversalRule( + [], + function Landmark_match(aAccessible) { + return Utils.getLandmarkName(aAccessible) ? FILTER_MATCH : + FILTER_IGNORE; + } + ), + Entry: new BaseTraversalRule( [ROLE_ENTRY, ROLE_PASSWORD_TEXT]), diff --git a/accessible/src/jsat/Utils.jsm b/accessible/src/jsat/Utils.jsm index 9968dbf15155..257a2e394c94 100644 --- a/accessible/src/jsat/Utils.jsm +++ b/accessible/src/jsat/Utils.jsm @@ -260,6 +260,28 @@ this.Utils = { } return true; + }, + + getLandmarkName: function getLandmarkName(aAccessible) { + const landmarks = [ + 'banner', + 'complementary', + 'contentinfo', + 'main', + 'navigation', + 'search' + ]; + let roles = this.getAttributes(aAccessible)['xml-roles']; + if (!roles) { + return; + } + + // Looking up a role that would match a landmark. + for (let landmark of landmarks) { + if (roles.indexOf(landmark) > -1) { + return landmark; + } + } } }; diff --git a/accessible/src/mac/Makefile.in b/accessible/src/mac/Makefile.in index 3f5cfc1e8d6f..90a6b6ae2d5c 100644 --- a/accessible/src/mac/Makefile.in +++ b/accessible/src/mac/Makefile.in @@ -13,9 +13,6 @@ EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ diff --git a/accessible/src/other/Makefile.in b/accessible/src/other/Makefile.in index ae3671607f36..1c65f82a96a6 100644 --- a/accessible/src/other/Makefile.in +++ b/accessible/src/other/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ diff --git a/accessible/src/windows/ia2/Makefile.in b/accessible/src/windows/ia2/Makefile.in index 3672bbb1f984..68a7528c813a 100644 --- a/accessible/src/windows/ia2/Makefile.in +++ b/accessible/src/windows/ia2/Makefile.in @@ -17,9 +17,6 @@ LIBXUL_LIBRARY = 1 # macros which conflicts with std::min/max. Suppress the macros: OS_CXXFLAGS += -DNOMINMAX -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk diff --git a/accessible/src/windows/msaa/Makefile.in b/accessible/src/windows/msaa/Makefile.in index 092deff85ed4..374684e665a3 100644 --- a/accessible/src/windows/msaa/Makefile.in +++ b/accessible/src/windows/msaa/Makefile.in @@ -13,9 +13,6 @@ LIBRARY_NAME = accessibility_toolkit_msaa_s EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/accessible/src/windows/sdn/Makefile.in b/accessible/src/windows/sdn/Makefile.in index b61c86a86d17..e29ceb897647 100644 --- a/accessible/src/windows/sdn/Makefile.in +++ b/accessible/src/windows/sdn/Makefile.in @@ -16,9 +16,6 @@ LIBXUL_LIBRARY = 1 # macros which conflicts with std::min/max. Suppress the macros: OS_CXXFLAGS += -DNOMINMAX -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk diff --git a/accessible/src/windows/uia/Makefile.in b/accessible/src/windows/uia/Makefile.in index 86f84a2a62dd..9422f8cb6a65 100644 --- a/accessible/src/windows/uia/Makefile.in +++ b/accessible/src/windows/uia/Makefile.in @@ -16,9 +16,6 @@ LIBXUL_LIBRARY = 1 # macros which conflicts with std::min/max. Suppress the macros: OS_CXXFLAGS += -DNOMINMAX -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk diff --git a/accessible/src/xpcom/Makefile.in b/accessible/src/xpcom/Makefile.in index 31d2b799a445..e048bb5a46cc 100644 --- a/accessible/src/xpcom/Makefile.in +++ b/accessible/src/xpcom/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - EXTRA_MDDEPEND_FILES = xpcAccEvents.pp include $(topsrcdir)/config/rules.mk diff --git a/accessible/src/xul/Makefile.in b/accessible/src/xul/Makefile.in index 8b134912ee08..c2dd89d8ffbf 100644 --- a/accessible/src/xul/Makefile.in +++ b/accessible/src/xul/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/addon-sdk/source/bin/activate.fish b/addon-sdk/source/bin/activate.fish new file mode 100644 index 000000000000..1f728b69be13 --- /dev/null +++ b/addon-sdk/source/bin/activate.fish @@ -0,0 +1,66 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.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 must be used with "source bin/activate.fish" *from fish* +# you cannot run it directly + +# Much of this code is based off of the activate.fish file for the +# virtualenv project. http://ur1.ca/ehmd6 + +function deactivate -d "Exit addon-sdk and return to normal shell environment" + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + + if test -n "$_OLD_PYTHONPATH" + set -gx PYTHONPATH $_OLD_PYTHONPATH + set -e _OLD_PYTHONPATH + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + functions -e fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + . ( begin + printf "function fish_prompt\n\t#" + functions _old_fish_prompt + end | psub ) + + functions -e _old_fish_prompt + end + + set -e CUDDLEFISH_ROOT + set -e VIRTUAL_ENV + + if test "$argv[1]" != "nondestructive" + functions -e deactivate + end +end + +# unset irrelavent variables +deactivate nondestructive + +set -gx _OLD_PYTHONPATH $PYTHONPATH +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx _OLD_FISH_PROMPT_OVERRIDE "true" + +set VIRTUAL_ENV (pwd) + +set -gx CUDDLEFISH_ROOT $VIRTUAL_ENV +set -gx PYTHONPATH "$VIRTUAL_ENV/python-lib" $PYTHONPATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# save the current fish_prompt function as the function _old_fish_prompt +. ( begin + printf "function _old_fish_prompt\n\t#" + functions fish_prompt + end | psub ) + +# with the original prompt function renamed, we can override with our own. +function fish_prompt + printf "(%s)%s%s" (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt) + return +end + +python -c "from jetpack_sdk_env import welcome; welcome()" diff --git a/addon-sdk/source/doc/dev-guide-source/credits.md b/addon-sdk/source/doc/dev-guide-source/credits.md index 8dfaad656bd9..30386881911b 100644 --- a/addon-sdk/source/doc/dev-guide-source/credits.md +++ b/addon-sdk/source/doc/dev-guide-source/credits.md @@ -43,6 +43,7 @@ We'd like to thank our many Jetpack project contributors! They include: ### F ### +* [Corey Farwell](http://github.com/frewsxcv) * [Matteo Ferretti](https://github.com/ZER0) * fuzzykiller diff --git a/addon-sdk/source/doc/module-source/sdk/page-mod/match-pattern.md b/addon-sdk/source/doc/module-source/sdk/page-mod/match-pattern.md deleted file mode 100644 index a3ccea863c6d..000000000000 --- a/addon-sdk/source/doc/module-source/sdk/page-mod/match-pattern.md +++ /dev/null @@ -1,259 +0,0 @@ - - -The `match-pattern` module can be used to test strings containing URLs -against simple patterns. - -## Specifying Patterns ## - -There are three ways you can specify patterns: - -* as an exact match string -* using a wildcard in a string -* using a regular expression - -### Exact Matches ### - -**A URL** matches only that URL. The URL must start with a scheme, end with a -slash, and contain no wildcards. - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLsExample non-matching URLs
"http://example.com/"http://example.com/http://example.com
- http://example.com/foo
- https://example.com/
- http://foo.example.com/
- -### Wildcards ### - -**A single asterisk** matches any URL with an `http`, `https`, or `ftp` -scheme. For other schemes like `file`, `resource`, or `data`, use a scheme -followed by an asterisk, as below. - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLsExample non-matching URLs
"*"http://example.com/
- https://example.com/
- ftp://example.com/
- http://bar.com/foo.js
- http://foo.com/
file://example.js
- resource://me/my-addon/data/file.html
- data:text/html,Hi there
- -**A domain name prefixed with an asterisk and dot** matches any URL of that -domain or a subdomain, using any of `http`, `https`, `ftp`. - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLsExample non-matching URLs
"*.example.com"http://example.com/
- http://foo.example.com/
- https://example.com/
- http://example.com/foo
- ftp://foo.example.com/
ldap://example.com
- http://example.foo.com/
- -**A URL followed by an asterisk** matches that URL and any URL prefixed with -the pattern. - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLsExample non-matching URLs
"https://foo.com/*"https://foo.com/
- https://foo.com/bar
http://foo.com/
- https://foo.com
- https://bar.foo.com/
- -**A scheme followed by an asterisk** matches all URLs with that scheme. To -match local files, use `file://*`, and to match files loaded from your -add-on's [data](modules/sdk/self.html#data) directory, use `resource://`. - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLs
"file://*"file://C:/file.html
- file:///home/file.png
"resource://*"resource://my-addon-at-me-dot-org/my-addon/data/file.html
"data:*"data:text/html,Hi there
- -### Regular Expressions ### - -You can specify patterns using a -[regular expression](https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions): - - var { MatchPattern } = require("sdk/page-mod/match-pattern"); - var pattern = new MatchPattern(/.*example.*/); - -The regular expression is subject to restrictions based on those applied to the -[HTML5 pattern attribute](http://dev.w3.org/html5/spec/common-input-element-attributes.html#attr-input-pattern). In particular: - -* The pattern must match the entire value, not just any subset. For example, the -pattern `/moz.*/` will not match the URL `http://mozilla.org`. - -* The expression is compiled with the `global`, `ignoreCase`, and `multiline` flags - disabled. The `MatchPattern` constructor will throw an exception - if you try to set any of these flags. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Example patternExample matching URLsExample non-matching URLs
/.*moz.*/http://foo.mozilla.org/
- http://mozilla.org
- https://mozilla.org
- http://foo.com/mozilla
- http://hemozoon.org
- mozscheme://foo.org
http://foo.org
-
/http:\/\/moz.*/http://mozilla.org
- http://mozzarella.com
https://mozilla.org
- http://foo.mozilla.org/
- http://foo.com/moz
/http.*moz.*/
http://foo.mozilla.org/
- http://mozilla.org
- http://hemozoon.org/
ftp://http/mozilla.org
- -## Examples ## - - var { MatchPattern } = require("sdk/page-mod/match-pattern"); - var pattern = new MatchPattern("http://example.com/*"); - console.log(pattern.test("http://example.com/")); // true - console.log(pattern.test("http://example.com/foo")); // true - console.log(pattern.test("http://foo.com/")); // false! - - -@class - -@constructor - This constructor creates match pattern objects that can be used to test URLs. -@param pattern {string} - The pattern to use. See Patterns above. - - - -@method - Tests a URL against the match pattern. -@param url {string} - The URL to test. -@returns {boolean} - True if the URL matches the pattern and false otherwise. - - diff --git a/addon-sdk/source/doc/static-files/media/xul-migration-cs.png b/addon-sdk/source/doc/static-files/media/xul-migration-cs.png deleted file mode 100644 index 639faaa2be35..000000000000 Binary files a/addon-sdk/source/doc/static-files/media/xul-migration-cs.png and /dev/null differ diff --git a/addon-sdk/source/lib/sdk/core/promise.js b/addon-sdk/source/lib/sdk/core/promise.js index 599b62654342..8b01a0f0a77a 100644 --- a/addon-sdk/source/lib/sdk/core/promise.js +++ b/addon-sdk/source/lib/sdk/core/promise.js @@ -22,6 +22,8 @@ return imports; }, this[factory.name], { uri: __URI__, id: id }); this.EXPORTED_SYMBOLS = [factory.name]; + } else if (~String(this).indexOf('Sandbox')) { // Sandbox + factory(function require(uri) {}, this, { id: id }); } else { // Browser or alike var globals = this; factory(function require(id) { diff --git a/addon-sdk/source/lib/sdk/indexed-db.js b/addon-sdk/source/lib/sdk/indexed-db.js index af6111d841c9..b0bd79b44990 100644 --- a/addon-sdk/source/lib/sdk/indexed-db.js +++ b/addon-sdk/source/lib/sdk/indexed-db.js @@ -56,7 +56,6 @@ exports.DOMException = Ci.nsIDOMDOMException; exports.IDBCursor = Ci.nsIIDBCursor; exports.IDBTransaction = Ci.nsIIDBTransaction; exports.IDBOpenDBRequest = Ci.nsIIDBOpenDBRequest; -exports.IDBVersionChangeEvent = Ci.nsIIDBVersionChangeEvent; exports.IDBDatabase = Ci.nsIIDBDatabase; exports.IDBIndex = Ci.nsIIDBIndex; exports.IDBObjectStore = Ci.nsIIDBObjectStore; diff --git a/addon-sdk/source/lib/sdk/panel/window.js b/addon-sdk/source/lib/sdk/panel/window.js index a69c2eea72b1..5110e4b3880a 100644 --- a/addon-sdk/source/lib/sdk/panel/window.js +++ b/addon-sdk/source/lib/sdk/panel/window.js @@ -3,6 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 'use strict'; +// The panel module currently supports only Firefox. +// See: https://bugzilla.mozilla.org/show_bug.cgi?id=jetpack-panel-apps +module.metadata = { + 'stability': 'unstable', + 'engines': { + 'Firefox': '*' + } +}; + const { getMostRecentBrowserWindow, windows: getWindows } = require('../window/utils'); const { ignoreWindow } = require('../private-browsing/utils'); const { isPrivateBrowsingSupported } = require('../self'); diff --git a/addon-sdk/source/lib/sdk/places/favicon.js b/addon-sdk/source/lib/sdk/places/favicon.js index baa77ed64822..1d0198c2d138 100644 --- a/addon-sdk/source/lib/sdk/places/favicon.js +++ b/addon-sdk/source/lib/sdk/places/favicon.js @@ -5,7 +5,10 @@ "use strict"; module.metadata = { - "stability": "unstable" + "stability": "unstable", + "engines": { + "Firefox": "*" + } }; const { Cc, Ci, Cu } = require("chrome"); diff --git a/addon-sdk/source/lib/sdk/test/utils.js b/addon-sdk/source/lib/sdk/test/utils.js index f9ff72184bba..6821bcf63f29 100644 --- a/addon-sdk/source/lib/sdk/test/utils.js +++ b/addon-sdk/source/lib/sdk/test/utils.js @@ -12,7 +12,8 @@ module.metadata = { function getTestNames (exports) Object.keys(exports).filter(name => /^test/.test(name)) -function isAsync (fn) fn.length > 1 +function isTestAsync (fn) fn.length > 1 +function isHelperAsync (fn) fn.length > 2 /* * Takes an `exports` object of a test file and a function `beforeFn` @@ -24,31 +25,31 @@ function isAsync (fn) fn.length > 1 function before (exports, beforeFn) { getTestNames(exports).map(name => { let testFn = exports[name]; - if (!isAsync(testFn) && !isAsync(beforeFn)) { + if (!isTestAsync(testFn) && !isHelperAsync(beforeFn)) { exports[name] = function (assert) { - beforeFn(name); + beforeFn(name, assert); testFn(assert); }; } - else if (isAsync(testFn) && !isAsync(beforeFn)) { + else if (isTestAsync(testFn) && !isHelperAsync(beforeFn)) { exports[name] = function (assert, done) { - beforeFn(name); + beforeFn(name, assert); testFn(assert, done); - } + }; } - else if (!isAsync(testFn) && isAsync(beforeFn)) { + else if (!isTestAsync(testFn) && isHelperAsync(beforeFn)) { exports[name] = function (assert, done) { - beforeFn(name, () => { + beforeFn(name, assert, () => { testFn(assert); done(); }); - } - } else if (isAsync(testFn) && isAsync(beforeFn)) { + }; + } else if (isTestAsync(testFn) && isHelperAsync(beforeFn)) { exports[name] = function (assert, done) { - beforeFn(name, () => { + beforeFn(name, assert, () => { testFn(assert, done); }); - } + }; } }); } @@ -64,31 +65,31 @@ exports.before = before; function after (exports, afterFn) { getTestNames(exports).map(name => { let testFn = exports[name]; - if (!isAsync(testFn) && !isAsync(afterFn)) { + if (!isTestAsync(testFn) && !isHelperAsync(afterFn)) { exports[name] = function (assert) { testFn(assert); - afterFn(name); + afterFn(name, assert); }; } - else if (isAsync(testFn) && !isAsync(afterFn)) { + else if (isTestAsync(testFn) && !isHelperAsync(afterFn)) { exports[name] = function (assert, done) { testFn(assert, () => { - afterFn(name); + afterFn(name, assert); done(); }); - } + }; } - else if (!isAsync(testFn) && isAsync(afterFn)) { + else if (!isTestAsync(testFn) && isHelperAsync(afterFn)) { exports[name] = function (assert, done) { testFn(assert); - afterFn(name, done); - } - } else if (isAsync(testFn) && isAsync(afterFn)) { + afterFn(name, assert, done); + }; + } else if (isTestAsync(testFn) && isHelperAsync(afterFn)) { exports[name] = function (assert, done) { testFn(assert, () => { - afterFn(name, done); + afterFn(name, assert, done); }); - } + }; } }); } diff --git a/addon-sdk/source/test/tabs/test-firefox-tabs.js b/addon-sdk/source/test/tabs/test-firefox-tabs.js index 14525306fd44..1d5346ac783a 100644 --- a/addon-sdk/source/test/tabs/test-firefox-tabs.js +++ b/addon-sdk/source/test/tabs/test-firefox-tabs.js @@ -8,9 +8,10 @@ const { Loader } = require('sdk/test/loader'); const timer = require('sdk/timers'); const { getOwnerWindow } = require('sdk/private-browsing/window/utils'); const { windows, onFocus, getMostRecentBrowserWindow } = require('sdk/window/utils'); -const { open, focus } = require('sdk/window/helpers'); +const { open, focus, close } = require('sdk/window/helpers'); const { StringBundle } = require('sdk/deprecated/app-strings'); const tabs = require('sdk/tabs'); +const { browserWindows } = require('sdk/windows'); const base64png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYA" + "AABzenr0AAAASUlEQVRYhe3O0QkAIAwD0eyqe3Q993AQ3cBSUKpygfsNTy" + @@ -93,14 +94,51 @@ exports.testAutomaticDestroy = function(test) { timer.setTimeout(function () { test.assert(!called, "Unloaded tab module is destroyed and inactive"); tab.close(test.done.bind(test)); - }, 0); + }); }); - tabs.open("data:text/html;charset=utf-8,foo"); }; -// test tab properties -exports.testTabProperties = function(test) { +exports.testTabPropertiesInNewWindow = function(test) { + test.waitUntilDone(); + + let count = 0; + function onReadyOrLoad (tab) { + if (count++) { + close(getOwnerWindow(tab)).then(test.done.bind(test)); + } + } + + let url = "data:text/html;charset=utf-8,foo foo"; + tabs.open({ + inNewWindow: true, + url: url, + onReady: function(tab) { + test.assertEqual(tab.title, "foo", "title of the new tab matches"); + test.assertEqual(tab.url, url, "URL of the new tab matches"); + test.assert(tab.favicon, "favicon of the new tab is not empty"); + test.assertEqual(tab.style, null, "style of the new tab matches"); + test.assertEqual(tab.index, 0, "index of the new tab matches"); + test.assertNotEqual(tab.getThumbnail(), null, "thumbnail of the new tab matches"); + test.assertNotEqual(tab.id, null, "a tab object always has an id property."); + + onReadyOrLoad(tab); + }, + onLoad: function(tab) { + test.assertEqual(tab.title, "foo", "title of the new tab matches"); + test.assertEqual(tab.url, url, "URL of the new tab matches"); + test.assert(tab.favicon, "favicon of the new tab is not empty"); + test.assertEqual(tab.style, null, "style of the new tab matches"); + test.assertEqual(tab.index, 0, "index of the new tab matches"); + test.assertNotEqual(tab.getThumbnail(), null, "thumbnail of the new tab matches"); + test.assertNotEqual(tab.id, null, "a tab object always has an id property."); + + onReadyOrLoad(tab); + } + }); +}; + +exports.testTabPropertiesInSameWindow = function(test) { test.waitUntilDone(); let count = 0; @@ -121,6 +159,7 @@ exports.testTabProperties = function(test) { test.assertEqual(tab.index, 1, "index of the new tab matches"); test.assertNotEqual(tab.getThumbnail(), null, "thumbnail of the new tab matches"); test.assertNotEqual(tab.id, null, "a tab object always has an id property."); + onReadyOrLoad(tab); }, onLoad: function(tab) { @@ -131,6 +170,7 @@ exports.testTabProperties = function(test) { test.assertEqual(tab.index, 1, "index of the new tab matches"); test.assertNotEqual(tab.getThumbnail(), null, "thumbnail of the new tab matches"); test.assertNotEqual(tab.id, null, "a tab object always has an id property."); + onReadyOrLoad(tab); } }); @@ -244,7 +284,7 @@ exports.testTabClose = function(test) { exports.testTabMove = function(test) { test.waitUntilDone(); - open().then(function(window) { + open().then(focus).then(function(window) { let url = "data:text/html;charset=utf-8,foo"; tabs.open({ @@ -965,8 +1005,6 @@ exports.testFaviconGetterDeprecation = function (test) { }); } - - /******************* helpers *********************/ // Helper for getting the active window diff --git a/addon-sdk/source/test/test-indexed-db.js b/addon-sdk/source/test/test-indexed-db.js index 5ba45670e6d1..8a2fa6457dcb 100644 --- a/addon-sdk/source/test/test-indexed-db.js +++ b/addon-sdk/source/test/test-indexed-db.js @@ -9,8 +9,7 @@ if (xulApp.versionInRange(xulApp.platformVersion, "16.0a1", "*")) { new function tests() { const { indexedDB, IDBKeyRange, DOMException, IDBCursor, IDBTransaction, - IDBOpenDBRequest, IDBVersionChangeEvent, IDBDatabase, IDBIndex, - IDBObjectStore, IDBRequest + IDBOpenDBRequest, IDBDatabase, IDBIndex, IDBObjectStore, IDBRequest } = require("sdk/indexed-db"); exports["test indexedDB is frozen"] = function(assert){ @@ -24,8 +23,8 @@ exports["test indexedDB is frozen"] = function(assert){ exports["test db variables"] = function(assert) { [ indexedDB, IDBKeyRange, DOMException, IDBCursor, IDBTransaction, - IDBOpenDBRequest, IDBOpenDBRequest, IDBVersionChangeEvent, - IDBDatabase, IDBIndex, IDBObjectStore, IDBRequest + IDBOpenDBRequest, IDBOpenDBRequest, IDBDatabase, IDBIndex, + IDBObjectStore, IDBRequest ].forEach(function(value) { assert.notEqual(typeof(value), "undefined", "variable is defined"); }); diff --git a/addon-sdk/source/test/test-panel.js b/addon-sdk/source/test/test-panel.js index dc6af5cff231..d6f4966f7bf2 100644 --- a/addon-sdk/source/test/test-panel.js +++ b/addon-sdk/source/test/test-panel.js @@ -1,7 +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/. */ - 'use strict'; +'use strict'; + +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; const { Cc, Ci } = require("chrome"); const { Loader } = require('sdk/test/loader'); @@ -923,18 +929,4 @@ else if (isGlobalPBSupported) { } } -try { - require("sdk/panel"); -} -catch (e) { - if (!/^Unsupported Application/.test(e.message)) - throw e; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(e.message); - } - } -} - require("test").run(exports); diff --git a/addon-sdk/source/test/test-path.js b/addon-sdk/source/test/test-path.js index 9c449c05adc8..9e9cb5c53190 100644 --- a/addon-sdk/source/test/test-path.js +++ b/addon-sdk/source/test/test-path.js @@ -335,8 +335,11 @@ if (isWindows) { // arguments result [[['/var/lib', '../', 'file/'], '/var/file'], [['/var/lib', '/../', 'file/'], '/file'], - [['a/b/c/', '../../..'], process.cwd()], - [['.'], process.cwd()], + // For some mysterious reasons OSX debug builds resolve incorrectly + // https://tbpl.mozilla.org/php/getParsedLog.php?id=25105489&tree=Mozilla-Inbound + // Disable this tests until Bug 891698 is fixed. + // [['a/b/c/', '../../..'], process.cwd()], + // [['.'], process.cwd()], [['/some/dir', '.', '/absolute/'], '/absolute']]; } var failures = []; diff --git a/addon-sdk/source/test/test-places-bookmarks.js b/addon-sdk/source/test/test-places-bookmarks.js index 80f1cf4cf711..af18f1f53f27 100644 --- a/addon-sdk/source/test/test-places-bookmarks.js +++ b/addon-sdk/source/test/test-places-bookmarks.js @@ -3,6 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 'use strict'; +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; + const { Cc, Ci } = require('chrome'); const { request } = require('sdk/addon/host'); const { filter } = require('sdk/event/utils'); @@ -13,8 +19,6 @@ const { defer, all } = require('sdk/core/promise'); const { defer: async } = require('sdk/lang/functional'); const { before, after } = require('sdk/test/utils'); -// Test for unsupported platforms -try { const { Bookmark, Group, Separator, save, search, remove, @@ -30,7 +34,6 @@ const bmsrv = Cc['@mozilla.org/browser/nav-bookmarks-service;1']. getService(Ci.nsINavBookmarksService); const tagsrv = Cc['@mozilla.org/browser/tagging-service;1']. getService(Ci.nsITaggingService); -} catch (e) { unsupported(e); } exports.testDefaultFolders = function (assert) { var ids = [ @@ -946,20 +949,6 @@ after(exports, name => { clearAllBookmarks(); }); -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -function unsupported (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(err.message); - } - }; -} - function saveP () { return promisedEmitter(save.apply(null, Array.slice(arguments))); } diff --git a/addon-sdk/source/test/test-places-favicon.js b/addon-sdk/source/test/test-places-favicon.js index 77f58888a3df..80f921f7d316 100644 --- a/addon-sdk/source/test/test-places-favicon.js +++ b/addon-sdk/source/test/test-places-favicon.js @@ -2,6 +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/. */ +'use strict'; + +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; + const { Cc, Ci, Cu } = require('chrome'); const { getFavicon } = require('sdk/places/favicon'); const tabs = require('sdk/tabs'); diff --git a/addon-sdk/source/test/test-places-history.js b/addon-sdk/source/test/test-places-history.js index f3829d01b4f4..d2c467bea5e7 100644 --- a/addon-sdk/source/test/test-places-history.js +++ b/addon-sdk/source/test/test-places-history.js @@ -1,14 +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/. */ - 'use strict' +'use strict'; + +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; const { Cc, Ci } = require('chrome'); const { defer, all } = require('sdk/core/promise'); const { has } = require('sdk/util/array'); const { setTimeout } = require('sdk/timers'); const { before, after } = require('sdk/test/utils'); -try { const { search } = require('sdk/places/history'); @@ -19,7 +24,6 @@ const { const { promisedEmitter } = require('sdk/places/utils'); const hsrv = Cc['@mozilla.org/browser/nav-history-service;1']. getService(Ci.nsINavHistoryService); -} catch(e) { unsupported(e); } exports.testEmptyQuery = function (assert, done) { let within = toBeWithin(); @@ -240,25 +244,11 @@ function clear (done) { clearHistory(done); } -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -function unsupported (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(err.message); - } - }; -} - function searchP () { return promisedEmitter(search.apply(null, Array.slice(arguments))); } -before(exports, (name, done) => clear(done)); -after(exports, (name, done) => clear(done)); +before(exports, (name, assert, done) => clear(done)); +after(exports, (name, assert, done) => clear(done)); require('test').run(exports); diff --git a/addon-sdk/source/test/test-places-host.js b/addon-sdk/source/test/test-places-host.js index c955f127c78a..b76049d5129a 100644 --- a/addon-sdk/source/test/test-places-host.js +++ b/addon-sdk/source/test/test-places-host.js @@ -3,12 +3,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 'use strict'; +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; + const { Cc, Ci } = require('chrome'); const { defer, all } = require('sdk/core/promise'); const { setTimeout } = require('sdk/timers'); const { newURI } = require('sdk/url/utils'); const { send } = require('sdk/addon/events'); -try { + require('sdk/places/host/host-bookmarks'); require('sdk/places/host/host-tags'); require('sdk/places/host/host-query'); @@ -24,7 +30,6 @@ const hsrv = Cc['@mozilla.org/browser/nav-history-service;1']. const tagsrv = Cc['@mozilla.org/browser/tagging-service;1']. getService(Ci.nsITaggingService); clearAllBookmarks(); -} catch(e) { unsupported(e); } exports.testBookmarksCreate = function (assert, done) { let items = [{ @@ -276,17 +281,4 @@ exports.testGetAllChildren = function (assert, done) { }); }; -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -function unsupported (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(err.message); - } - }; -} require('test').run(exports); diff --git a/addon-sdk/source/test/test-places-utils.js b/addon-sdk/source/test/test-places-utils.js index 0babcc12e23f..54b039358bc7 100644 --- a/addon-sdk/source/test/test-places-utils.js +++ b/addon-sdk/source/test/test-places-utils.js @@ -3,11 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 'use strict'; +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; + const { defer, all } = require('sdk/core/promise'); const { setTimeout } = require('sdk/timers'); -try { const { TreeNode } = require('sdk/places/utils'); -} catch(e) { unsupported(e); } exports['test construct tree'] = function (assert) { let tree = TreeNode(1); @@ -74,18 +78,4 @@ exports['test async walk'] = function (assert, done) { }); }; -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -function unsupported (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(err.message); - } - }; -} - require('test').run(exports); diff --git a/addon-sdk/source/test/test-selection.js b/addon-sdk/source/test/test-selection.js index 7826234716e5..0b6a2c11fd7c 100644 --- a/addon-sdk/source/test/test-selection.js +++ b/addon-sdk/source/test/test-selection.js @@ -2,7 +2,13 @@ * License, v. 2.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"; +'use strict'; + +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; const HTML = "\ \ @@ -988,21 +994,4 @@ if (!require("sdk/private-browsing/utils").isWindowPBSupported) { }); } -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -try { - require("sdk/selection"); -} -catch (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - "test Unsupported Application": function Unsupported (assert) { - assert.pass(err.message); - } - } -} - require("test").run(exports) diff --git a/addon-sdk/source/test/test-tab-browser.js b/addon-sdk/source/test/test-tab-browser.js index fc723be35f65..4178cdf61e2f 100644 --- a/addon-sdk/source/test/test-tab-browser.js +++ b/addon-sdk/source/test/test-tab-browser.js @@ -1,7 +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/. */ -"use strict"; +'use strict'; + +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; var timer = require("sdk/timers"); var { Cc, Ci } = require("chrome"); @@ -492,21 +498,4 @@ function activeWindow() { return Cc["@mozilla.org/appshell/window-mediator;1"]. getService(Ci.nsIWindowMediator). getMostRecentWindow("navigator:browser"); -}; - -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -try { - require("sdk/deprecated/tab-browser"); -} -catch (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - testAppNotSupported: function (test) { - test.pass(err.message); - } - }; } diff --git a/addon-sdk/source/test/test-test-utils-async.js b/addon-sdk/source/test/test-test-utils-async.js index 1eaaa66860f1..6699fd55bac8 100644 --- a/addon-sdk/source/test/test-test-utils-async.js +++ b/addon-sdk/source/test/test-test-utils-async.js @@ -55,21 +55,23 @@ exports.testSyncAfter = function (assert) { AFTER_RUN = 0; }; -before(exports, (name, done) => { +before(exports, (name, assert, done) => { if (name === 'testABeforeNameAsync') BEFORE_RUN = 2; else BEFORE_RUN = 1; + assert.pass('assert passed into before function'); async(done)(); }); -after(exports, (name, done) => { +after(exports, (name, assert, done) => { // testAfterName runs after testAfter, which is where this // check occurs in the assertation if (name === 'testAfterAsync') AFTER_RUN = 2; else AFTER_RUN = 1; + assert.pass('assert passed into after function'); async(done)(); }); diff --git a/addon-sdk/source/test/test-test-utils-sync.js b/addon-sdk/source/test/test-test-utils-sync.js index 97f875be248d..c8f0c00b84cc 100644 --- a/addon-sdk/source/test/test-test-utils-sync.js +++ b/addon-sdk/source/test/test-test-utils-sync.js @@ -55,20 +55,22 @@ exports.testSyncAfter = function (assert) { AFTER_RUN = 0; }; -before(exports, (name) => { +before(exports, (name, assert) => { if (name === 'testABeforeNameAsync') BEFORE_RUN = 2; else BEFORE_RUN = 1; + assert.pass('assert passed into before function'); }); -after(exports, (name) => { +after(exports, (name, assert) => { // testAfterName runs after testAfter, which is where this // check occurs in the assertation if (name === 'testAfterAsync') AFTER_RUN = 2; else AFTER_RUN = 1; + assert.pass('assert passed into after function'); }); require('sdk/test').run(exports); diff --git a/addon-sdk/source/test/test-widget.js b/addon-sdk/source/test/test-widget.js index 3c4d2f0df07d..451591681586 100644 --- a/addon-sdk/source/test/test-widget.js +++ b/addon-sdk/source/test/test-widget.js @@ -1,8 +1,15 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.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"; +'use strict'; +module.metadata = { + 'engines': { + 'Firefox': '*' + } +}; + +const widgets = require("sdk/widget"); const { Cc, Ci } = require("chrome"); const { Loader } = require('sdk/test/loader'); const url = require("sdk/url"); @@ -1174,22 +1181,3 @@ function closeBrowserWindow(window, callback) { window.close(); }, 0); } - -// ADD NO TESTS BELOW THIS LINE! /////////////////////////////////////////////// - -// If the module doesn't support the app we're being run in, require() will -// throw. In that case, remove all tests above from exports, and add one dummy -// test that passes. -try { - const widgets = require("sdk/widget"); -} -catch (err) { - if (!/^Unsupported Application/.test(err.message)) - throw err; - - module.exports = { - testAppNotSupported: function (test) { - test.pass(err.message); - } - }; -} diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 118fc4e27a55..129e9bb50066 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -648,6 +648,7 @@ pref("dom.disable_window_open_dialog_feature", true); // Screen reader support pref("accessibility.accessfu.activate", 2); +pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,Landmark,ListItem"); // Setting for an utterance order (0 - description first, 1 - description last). pref("accessibility.accessfu.utterance", 1); // Whether to skip images with empty alt text @@ -739,6 +740,6 @@ pref("ping.manifestURL", "https://marketplace.firefox.com/packaged.webapp"); // Enable the disk space watcher pref("disk_space_watcher.enabled", true); -// Enable future -pref("dom.future.enabled", false); +// Enable promise +pref("dom.promise.enabled", false); diff --git a/browser/app/firefox.exe.manifest b/browser/app/firefox.exe.manifest index b5a6cc7c4bca..521405477381 100644 --- a/browser/app/firefox.exe.manifest +++ b/browser/app/firefox.exe.manifest @@ -33,7 +33,10 @@ - + + + + diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 294c4cfba1b0..79b855e449aa 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -207,7 +207,6 @@ pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name", "chrome://browser pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description", "chrome://browser/locale/browser.properties"); pref("xpinstall.whitelist.add", "addons.mozilla.org"); -pref("xpinstall.whitelist.add.36", "getpersonas.com"); pref("xpinstall.whitelist.add.180", "marketplace.firefox.com"); pref("lightweightThemes.update.enabled", true); diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 7fe05923b1b7..4034a220deb0 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -1105,11 +1105,11 @@ } } - // If the find bar is focused, keep it focused. - if (gFindBarInitialized && - !gFindBar.hidden && - gFindBar.getElement("findbar-textbox").getAttribute("focused") == "true") + // If the find bar is open, focus it. + if (gFindBarInitialized && !gFindBar.hidden) { + gFindBar._findField.focus(); break; + } // Otherwise, focus the content area. let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager); diff --git a/browser/base/content/test/browser_bug537013.js b/browser/base/content/test/browser_bug537013.js index 87080b879a45..2a54dfc96407 100644 --- a/browser/base/content/test/browser_bug537013.js +++ b/browser/base/content/test/browser_bug537013.js @@ -69,6 +69,9 @@ function continueTests() { ok(gFindBar.hidden, "First tab doesn't show find bar!"); gBrowser.selectedTab = tabs[1]; ok(!gFindBar.hidden, "Second tab shows find bar!"); + // Test for bug 892384 + is(gFindBar._findField.getAttribute("focused"), "true", + "Open findbar refocused on tab change!"); gBrowser.selectedTab = tabs[0]; ok(gFindBar.hidden, "First tab doesn't show find bar!"); diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js index be77782ae990..088f26e4e31a 100644 --- a/browser/components/preferences/advanced.js +++ b/browser/components/preferences/advanced.js @@ -630,6 +630,7 @@ var gAdvancedPane = { #ifdef MOZ_METRO if (this._showingWin8Prefs) { warnIncompatible.disabled |= metroEnabledPref.value; + warnIncompatible.checked |= metroEnabledPref.value; } #endif #endif @@ -680,6 +681,7 @@ var gAdvancedPane = { { var enabledPref = document.getElementById("app.update.enabled"); var autoPref = document.getElementById("app.update.auto"); + var modePref = document.getElementById("app.update.mode"); #ifdef XP_WIN #ifdef MOZ_METRO var metroEnabledPref = document.getElementById("app.update.metro.enabled"); @@ -701,6 +703,7 @@ var gAdvancedPane = { enabledPref.value = true; autoPref.value = true; metroEnabledPref.value = true; + modePref.value = 1; break; #endif #endif @@ -714,7 +717,6 @@ var gAdvancedPane = { } var warnIncompatible = document.getElementById("warnIncompatible"); - var modePref = document.getElementById("app.update.mode"); warnIncompatible.disabled = enabledPref.locked || !enabledPref.value || autoPref.locked || !autoPref.value || modePref.locked; @@ -723,6 +725,7 @@ var gAdvancedPane = { #ifdef MOZ_METRO if (this._showingWin8Prefs) { warnIncompatible.disabled |= metroEnabledPref.value; + warnIncompatible.checked |= metroEnabledPref.value; } #endif #endif diff --git a/browser/components/preferences/in-content/advanced.js b/browser/components/preferences/in-content/advanced.js index 466d99117069..a9e441e08fe6 100644 --- a/browser/components/preferences/in-content/advanced.js +++ b/browser/components/preferences/in-content/advanced.js @@ -613,6 +613,7 @@ var gAdvancedPane = { #ifdef MOZ_METRO if (this._showingWin8Prefs) { warnIncompatible.disabled |= metroEnabledPref.value; + warnIncompatible.checked |= metroEnabledPref.value; } #endif #endif @@ -645,6 +646,7 @@ var gAdvancedPane = { { var enabledPref = document.getElementById("app.update.enabled"); var autoPref = document.getElementById("app.update.auto"); + var modePref = document.getElementById("app.update.mode"); #ifdef XP_WIN #ifdef MOZ_METRO var metroEnabledPref = document.getElementById("app.update.metro.enabled"); @@ -666,6 +668,7 @@ var gAdvancedPane = { enabledPref.value = true; autoPref.value = true; metroEnabledPref.value = true; + modePref.value = 1; break; #endif #endif @@ -679,7 +682,6 @@ var gAdvancedPane = { } var warnIncompatible = document.getElementById("warnIncompatible"); - var modePref = document.getElementById("app.update.mode"); warnIncompatible.disabled = enabledPref.locked || !enabledPref.value || autoPref.locked || !autoPref.value || modePref.locked; @@ -687,6 +689,7 @@ var gAdvancedPane = { #ifdef MOZ_METRO if (this._showingWin8Prefs) { warnIncompatible.disabled |= metroEnabledPref.value; + warnIncompatible.checked |= metroEnabledPref.value; } #endif #endif diff --git a/browser/config/mozconfigs/linux32/nightly b/browser/config/mozconfigs/linux32/nightly index 8daaec36e3da..f0b34f1e3e31 100644 --- a/browser/config/mozconfigs/linux32/nightly +++ b/browser/config/mozconfigs/linux32/nightly @@ -3,6 +3,7 @@ ac_add_options --enable-codesighs ac_add_options --enable-signmar ac_add_options --enable-profiling +ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling # Nightlies only since this has a cost in performance ac_add_options --enable-js-diagnostics diff --git a/browser/config/mozconfigs/linux64/nightly b/browser/config/mozconfigs/linux64/nightly index 223624b630f3..024c986662eb 100644 --- a/browser/config/mozconfigs/linux64/nightly +++ b/browser/config/mozconfigs/linux64/nightly @@ -3,6 +3,7 @@ ac_add_options --enable-codesighs ac_add_options --enable-signmar ac_add_options --enable-profiling +ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling # Nightlies only since this has a cost in performance ac_add_options --enable-js-diagnostics diff --git a/browser/confvars.sh b/browser/confvars.sh index 88c8af12c00c..ac28078dee67 100755 --- a/browser/confvars.sh +++ b/browser/confvars.sh @@ -57,3 +57,4 @@ MOZ_MEDIA_NAVIGATOR=1 if test "$OS_TARGET" = "WINNT" -o "$OS_TARGET" = "Darwin"; then MOZ_FOLD_LIBS=1 fi +MOZ_WEBGL_CONFORMANT=1 diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index 8580a71d6df2..d21f72037bbe 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -1017,9 +1017,8 @@ var BrowserUI = { } // Check content helper - let contentHelper = Elements.contentNavigator; - if (contentHelper.isActive) { - contentHelper.model.hide(); + if (FindHelperUI.isActive) { + FindHelperUI.hide(); return; } diff --git a/browser/metro/theme/browser.css b/browser/metro/theme/browser.css index b4e125d10330..636f9ab918de 100644 --- a/browser/metro/theme/browser.css +++ b/browser/metro/theme/browser.css @@ -161,6 +161,9 @@ documenttab[closing] > .documenttab-container { width: @thumbnail_width@; height: @thumbnail_height@; } +#tray:not([expanded]) .documenttab-thumbnail { + background-image: none!important; +} .documenttab-title { margin: @metro_spacing_normal@ @metro_spacing_snormal@; diff --git a/build/autoconf/android.m4 b/build/autoconf/android.m4 index fa31afbf42bf..9fea2a9aba07 100644 --- a/build/autoconf/android.m4 +++ b/build/autoconf/android.m4 @@ -69,7 +69,7 @@ case "$target" in kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"` - for version in $android_gnu_compiler_version 4.6 4.4.3 ; do + for version in $android_gnu_compiler_version 4.7 4.6 4.4.3 ; do case "$target_cpu" in arm) target_name=arm-linux-androideabi-$version diff --git a/build/unix/elfhack/elfhack.cpp b/build/unix/elfhack/elfhack.cpp index 712a7497e80b..55268d7a6608 100644 --- a/build/unix/elfhack/elfhack.cpp +++ b/build/unix/elfhack/elfhack.cpp @@ -16,6 +16,9 @@ #ifndef R_ARM_V4BX #define R_ARM_V4BX 0x28 #endif +#ifndef R_ARM_JUMP24 +#define R_ARM_JUMP24 0x1d +#endif #ifndef R_ARM_THM_JUMP24 #define R_ARM_THM_JUMP24 0x1e #endif @@ -326,6 +329,7 @@ class ElfRelHackCode_Section: public ElfSection { case REL(ARM, REL32): apply_relocation(the_code, buf, &*r, addr); break; + case REL(ARM, JUMP24): case REL(ARM, PLT32): apply_relocation(the_code, buf, &*r, addr); break; diff --git a/build/unix/mozconfig.linux b/build/unix/mozconfig.linux index 6324ba718531..60fc174c91f1 100644 --- a/build/unix/mozconfig.linux +++ b/build/unix/mozconfig.linux @@ -2,3 +2,5 @@ CC="/tools/gcc-4.7.2-0moz1/bin/gcc" CXX="/tools/gcc-4.7.2-0moz1/bin/g++" + +ac_add_options --enable-elf-hack diff --git a/caps/src/Makefile.in b/caps/src/Makefile.in index 96a12d49fc43..b5804cf4278e 100644 --- a/caps/src/Makefile.in +++ b/caps/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/chrome/src/Makefile.in b/chrome/src/Makefile.in index 2f8a78c0811f..5ab2203e1a9b 100644 --- a/chrome/src/Makefile.in +++ b/chrome/src/Makefile.in @@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = chrome_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/config/Makefile.in b/config/Makefile.in index f82a659c416b..d6cd35a12bcb 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -73,9 +73,6 @@ ifeq ($(OS_CONFIG),SunOS4.1) NSPR_CFLAGS += -I$(srcdir)/../nsprpub/pr/include/md endif -export:: - -$(RM) $(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES) - # Generate a new buildid every time we "export" in config... that's only # supposed to be once per-build! export:: diff --git a/config/config.mk b/config/config.mk index 389b8077809e..e2fa07f47ad1 100644 --- a/config/config.mk +++ b/config/config.mk @@ -116,10 +116,6 @@ endif OS_CONFIG := $(OS_ARCH)$(OS_RELEASE) -FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs -FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps -FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names - MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX) MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX) @@ -328,14 +324,7 @@ endif # building libxul libraries ifdef LIBXUL_LIBRARY DEFINES += \ - -D_IMPL_NS_COM \ - -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ - -D_IMPL_NS_GFX \ - -D_IMPL_NS_WIDGET \ - -DIMPL_XREAPI \ - -DIMPL_NS_NET \ - -DIMPL_THEBES \ + -DIMPL_LIBXUL \ $(NULL) ifndef JS_SHARED_LIBRARY @@ -813,3 +802,11 @@ MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS) endif DEFINES += -DNO_NSPR_10_SUPPORT + +# Run a named Python build action. The first argument is the name of the build +# action. The second argument are the arguments to pass to the action (space +# delimited arguments). e.g. +# +# libs:: +# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest) +py_action = $(PYTHON) -m mozbuild.action.$(1) $(2) diff --git a/config/makefiles/target_export.mk b/config/makefiles/target_export.mk index 7aa530bfe99f..d626af8674a9 100644 --- a/config/makefiles/target_export.mk +++ b/config/makefiles/target_export.mk @@ -30,18 +30,3 @@ export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(LOOP_OVER_DIRS) $(LOOP_OVER_TOOL_DIRS) - -# -# Rule to create list of libraries for final link -# -# todo: use pre-req deps rather than conditionals -export:: export-gen-final-lib-link-list -export-gen-final-lib-link-list: -ifdef LIBRARY_NAME #{ -ifdef EXPORT_LIBRARY #{ -ifdef IS_COMPONENT #{ -else # !IS_COMPONENT - $(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME) -endif #} IS_COMPONENT -endif #} EXPORT_LIBRARY -endif #} LIBRARY_NAME diff --git a/config/makefiles/test/Makefile.in b/config/makefiles/test/Makefile.in index 6472b525e6e4..8bb01d0ba2ff 100644 --- a/config/makefiles/test/Makefile.in +++ b/config/makefiles/test/Makefile.in @@ -19,12 +19,10 @@ include $(topsrcdir)/config/makefiles/makeutils.mk dir-ts = .deps/test check-arglist = $(dir-ts)/arglist.ts check-autotargets = $(dir-ts)/autotargets_mk.ts -check-export-targets = $(dir-ts)/export-targets-mk.ts check-XinY = $(dir-ts)/check_XinY_mk.ts check-tests =\ $(check-arglist) \ $(check-autotargets) \ - $(check-export-targets) \ $(check-XinY) \ $(NULL) @@ -104,22 +102,4 @@ $(check-autotargets): $(check-autotargets-preqs) @$(TOUCH) $@ # - -########################################################################### -# -check-export-targets-preqs=\ - $(call mkdir_deps,$(dir-ts)) \ - $(topsrcdir)/config/makefiles/makeutils.mk \ - $(topsrcdir)/config/makefiles/target_export.mk \ - $(srcdir)/check-export-targets.mk \ - checkup \ - $(NULL) - -# include then test -checkup: $(eval include $(srcdir)/check-export-targets.mk) - -$(check-export-targets): $(check-export-targets-preqs) - @$(TOUCH) $@ -# - endif #} findstring MAKECMDGOAL diff --git a/config/makefiles/test/check-export-targets.mk b/config/makefiles/test/check-export-targets.mk deleted file mode 100644 index c248c9b023c0..000000000000 --- a/config/makefiles/test/check-export-targets.mk +++ /dev/null @@ -1,33 +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/. - -ifdef VERBOSE - $(warning loading test) -endif - -MOZILLA_DIR ?= $(topsrcdir) -checkup = \ - check-final-lib-link-list \ - $(NULL) - -checkup: $(checkup) - - -# -LIBRARY_NAME = foo# real_data: xptcmd -EXPORT_LIBRARY = foo# real_data: ../.. -undefine IS_COMPONENT - -test-data = $(CURDIR)/check-export-targets-test-data -FINAL_LINK_LIBS = $(test-data) -STATIC_LIBRARY_NAME = /dev/null - -check-final-lib-link-list: export-gen-final-lib-link-list - @cat $(test-data) -# - - -include $(topsrcdir)/config/makefiles/target_export.mk diff --git a/config/makefiles/xpcshell.mk b/config/makefiles/xpcshell.mk index 0af8caff7571..0a49e2c1c9de 100644 --- a/config/makefiles/xpcshell.mk +++ b/config/makefiles/xpcshell.mk @@ -29,9 +29,7 @@ libs:: libs-xpcshell-tests libs-xpcshell-tests: $(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS)) ifndef NO_XPCSHELL_MANIFEST_CHECK #{ - $(PYTHON) $(MOZILLA_DIR)/build/xpccheck.py \ - $(topsrcdir) \ - $(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS)) + $(call py_action,xpccheck,$(topsrcdir) $(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS))) endif #} NO_XPCSHELL_MANIFEST_CHECK ########################################################################### diff --git a/configure.in b/configure.in index 1a49d1df99d4..a0575dcf086c 100644 --- a/configure.in +++ b/configure.in @@ -1341,6 +1341,15 @@ if test "$GNU_CC"; then AC_TRY_LINK(,,AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) LDFLAGS=$_SAVE_LDFLAGS) + + AC_MSG_CHECKING([for -z text option to ld]) + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-z,text" + AC_TRY_LINK(,,AC_MSG_RESULT([yes]) + [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"], + AC_MSG_RESULT([no]) + LDFLAGS=$_SAVE_LDFLAGS) + AC_MSG_CHECKING([for --build-id option to ld]) _SAVE_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,--build-id" @@ -2174,7 +2183,6 @@ ia64*-hpux*) AC_DEFINE(XP_WIN32) AC_DEFINE(HW_THREADS) AC_DEFINE(STDC_HEADERS) - AC_DEFINE(NEW_H, ) AC_DEFINE(WIN32_LEAN_AND_MEAN) TARGET_MD_ARCH=win32 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows' @@ -3060,14 +3068,6 @@ if test "$ac_cv_sockaddr_sa_len" = true ; then AC_DEFINE(HAVE_SA_LEN) fi -dnl Check whether the compiler supports the new-style C++ standard -dnl library headers (i.e. ) or needs the old "new.h" -AC_LANG_CPLUSPLUS -NEW_H=new.h -MOZ_CHECK_HEADER(new, [NEW_H=new]) -AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>) -AC_LANG_C - AC_ARG_ENABLE(dtrace, [ --enable-dtrace build with dtrace support if available (default=no)], [enable_dtrace="yes"],) @@ -6012,6 +6012,10 @@ if test -n "$MOZ_WEBGL_DISABLED"; then MOZ_ANGLE_RENDERER= fi +if test -n "$MOZ_WEBGL_CONFORMANT"; then + AC_DEFINE(MOZ_WEBGL_CONFORMANT) +fi + # Locate a DirectX SDK here so we can use it for both ANGLE and # Joystick support. if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then @@ -7553,13 +7557,16 @@ dnl ======================================================== USE_ELF_HACK=1 MOZ_ARG_DISABLE_BOOL(elf-hack, [ --disable-elf-hack Disable elf hacks], - USE_ELF_HACK=, - USE_ELF_HACK=1) + [USE_ELF_HACK=], + [USE_ELF_HACK=F # Force enable elf-hack]) # Disable elf hack for profiling because the built in profiler # doesn't read the segments properly with elf hack. This is # temporary and should be fixed soon in the profiler. if test "$MOZ_PROFILING" = 1; then + if test "$USE_ELF_HACK" = F; then + AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling]) + fi USE_ELF_HACK= fi @@ -7582,7 +7589,7 @@ if test "$USE_ELF_HACK" = 1; then esac fi -if test "$USE_ELF_HACK" = 1; then +if test -n "$USE_ELF_HACK"; then dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on dnl memory addresses it maps to. The result is that by the time elfhack dnl kicks in, it is not possible to apply relocations because of that, @@ -7590,7 +7597,8 @@ if test "$USE_ELF_HACK" = 1; then dnl segment. It makes elfhack mostly useless, so considering the problems dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when - dnl the linker creates PT_GNU_RELRO segments. + dnl the linker creates PT_GNU_RELRO segments. However, when we do want + dnl elfhack enabled, disable PT_GNU_RELRO instead. AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments], LINK_WITH_PT_GNU_RELRO, [echo "int main() {return 0;}" > conftest.${ac_ext} @@ -7607,8 +7615,18 @@ if test "$USE_ELF_HACK" = 1; then fi rm -rf conftest*]) if test "$LINK_WITH_PT_GNU_RELRO" = yes; then - AC_MSG_WARN([Disabling elfhack]) - USE_ELF_HACK= + if test "$USE_ELF_HACK" = F; then + AC_MSG_CHECKING([for -z norelro option to ld]) + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-z,norelro" + AC_TRY_LINK(,,AC_MSG_RESULT([yes]) + [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"], + AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.])) + USE_ELF_HACK=1 + else + AC_MSG_WARN([Disabling elfhack]) + USE_ELF_HACK= + fi fi fi @@ -9104,7 +9122,6 @@ HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR HAVE_CPP_PARTIAL_SPECIALIZATION HAVE_CPP_TROUBLE_COMPARING_TO_ZERO NEED_CPP_UNUSED_IMPLEMENTATIONS -NEW_H HAVE_GETPAGESIZE HAVE_ICONV HAVE_ICONV_WITH_CONST_INPUT diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 63f192f8af5d..3171afd30a1e 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -33,8 +33,8 @@ enum nsLinkState { // IID for the nsIContent interface #define NS_ICONTENT_IID \ -{ 0x8a8b4b1d, 0x72d8, 0x428e, \ - { 0x95, 0x75, 0xf9, 0x18, 0xba, 0xf6, 0x9e, 0xa1 } } +{ 0Xf22c131c, 0Xc554, 0X4d06, \ + { 0X81, 0Xac, 0X86, 0X64, 0X2f, 0X05, 0Xcc, 0X81 } } /** * A node of content in a document's content model. This interface @@ -305,6 +305,12 @@ class nsIContent : public nsINode { return mNodeInfo->Equals(aTag, kNameSpaceID_MathML); } + inline bool IsActiveChildrenElement() const + { + return mNodeInfo->Equals(nsGkAtoms::children, kNameSpaceID_XBL) && + GetBindingParent(); + } + /** * Returns an atom holding the name of the attribute of type ID on * this content node (if applicable). Returns null for non-element diff --git a/content/base/src/Attr.h b/content/base/src/Attr.h index 0b9d4a5b53c2..043aa0beb8e7 100644 --- a/content/base/src/Attr.h +++ b/content/base/src/Attr.h @@ -26,8 +26,8 @@ namespace dom { // Attribute helper class used to wrap up an attribute with a dom // object that implements nsIDOMAttr and nsIDOMNode -class Attr : public nsIAttribute, - public nsIDOMAttr +class Attr MOZ_FINAL : public nsIAttribute, + public nsIDOMAttr { public: Attr(nsDOMAttributeMap* aAttrMap, diff --git a/content/base/src/ChildIterator.cpp b/content/base/src/ChildIterator.cpp index f3f43e517e37..fa83d891c571 100644 --- a/content/base/src/ChildIterator.cpp +++ b/content/base/src/ChildIterator.cpp @@ -16,7 +16,7 @@ ExplicitChildIterator::GetNextChild() // If we're already in the inserted-children array, look there first if (mIndexInInserted) { MOZ_ASSERT(mChild); - MOZ_ASSERT(mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)); + MOZ_ASSERT(mChild->IsActiveChildrenElement()); MOZ_ASSERT(!mDefaultChild); XBLChildrenElement* point = static_cast(mChild); @@ -28,7 +28,7 @@ ExplicitChildIterator::GetNextChild() } else if (mDefaultChild) { // If we're already in default content, check if there are more nodes there MOZ_ASSERT(mChild); - MOZ_ASSERT(mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)); + MOZ_ASSERT(mChild->IsActiveChildrenElement()); mDefaultChild = mDefaultChild->GetNextSibling(); if (mDefaultChild) { @@ -44,8 +44,7 @@ ExplicitChildIterator::GetNextChild() } // Iterate until we find a non-, or a with content. - while (mChild && - mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + while (mChild && mChild->IsActiveChildrenElement()) { XBLChildrenElement* point = static_cast(mChild); if (!point->mInsertedChildren.IsEmpty()) { mIndexInInserted = 1; @@ -85,6 +84,7 @@ FlattenedChildIterator::FlattenedChildIterator(nsIContent* aParent) child; child = child->GetNextSibling()) { if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + MOZ_ASSERT(child->GetBindingParent()); mXBLInvolved = true; break; } @@ -131,8 +131,7 @@ nsIContent* FlattenedChildIterator::GetPreviousChild() } // Iterate until we find a non-, or a with content. - while (mChild && - mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + while (mChild && mChild->IsActiveChildrenElement()) { XBLChildrenElement* point = static_cast(mChild); if (!point->mInsertedChildren.IsEmpty()) { mIndexInInserted = point->InsertedChildrenLength(); diff --git a/content/base/src/Comment.h b/content/base/src/Comment.h index 375d3d081dbf..530f2ab89c05 100644 --- a/content/base/src/Comment.h +++ b/content/base/src/Comment.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class Comment : public nsGenericDOMDataNode, - public nsIDOMComment +class Comment MOZ_FINAL : public nsGenericDOMDataNode, + public nsIDOMComment { private: void Init() diff --git a/content/base/src/DocumentFragment.h b/content/base/src/DocumentFragment.h index 47cce72d8181..884779f54fbc 100644 --- a/content/base/src/DocumentFragment.h +++ b/content/base/src/DocumentFragment.h @@ -23,8 +23,8 @@ namespace dom { class Element; class HTMLTemplateElement; -class DocumentFragment : public FragmentOrElement, - public nsIDOMDocumentFragment +class DocumentFragment MOZ_FINAL : public FragmentOrElement, + public nsIDOMDocumentFragment { private: void Init() diff --git a/content/base/src/DocumentType.h b/content/base/src/DocumentType.h index edc4176af4ef..507a6dd7cf97 100644 --- a/content/base/src/DocumentType.h +++ b/content/base/src/DocumentType.h @@ -38,7 +38,7 @@ class DocumentTypeForward : public nsGenericDOMDataNode, NS_FORWARD_NSIDOMNODE_TO_NSINODE }; -class DocumentType : public DocumentTypeForward +class DocumentType MOZ_FINAL : public DocumentTypeForward { public: DocumentType(already_AddRefed aNodeInfo, diff --git a/content/base/src/Makefile.in b/content/base/src/Makefile.in index e91a27665878..81d519ff4632 100644 --- a/content/base/src/Makefile.in +++ b/content/base/src/Makefile.in @@ -22,10 +22,6 @@ endif GQI_SRCS = contentbase.gqi -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - EXTRA_COMPONENTS = \ contentSecurityPolicy.manifest \ contentAreaDropListener.js \ diff --git a/content/base/src/nsGenConImageContent.cpp b/content/base/src/nsGenConImageContent.cpp index 14750c530c0a..11939443804d 100644 --- a/content/base/src/nsGenConImageContent.cpp +++ b/content/base/src/nsGenConImageContent.cpp @@ -17,8 +17,8 @@ #include "nsEventStates.h" #include "nsEventDispatcher.h" -class nsGenConImageContent : public nsXMLElement, - public nsImageLoadingContent +class nsGenConImageContent MOZ_FINAL : public nsXMLElement, + public nsImageLoadingContent { public: nsGenConImageContent(already_AddRefed aNodeInfo) diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 6c9fbf941ea2..b4e1ebc259a2 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -3216,7 +3216,7 @@ nsObjectLoadingContent::SetupProtoChain(JSContext* aCx, return; } - if (pi_proto && js::GetObjectClass(pi_proto) != &js::ObjectClass) { + if (pi_proto && js::GetObjectClass(pi_proto) != js::ObjectClassPtr) { // The plugin wrapper has a proto that's not Object.prototype, set // 'pi.__proto__.__proto__' to the original 'this.__proto__' if (pi_proto != my_proto && !::JS_SetPrototype(aCx, pi_proto, my_proto)) { diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 1d78cb45aacf..c8f0c25fc921 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -13,9 +13,7 @@ #include "nsString.h" #include "nsReadableUtils.h" #include "nsIDOMNode.h" -#include "nsIDOMDocument.h" #include "nsIDOMDocumentFragment.h" -#include "nsIDOMDocumentType.h" #include "nsIContent.h" #include "nsIDocument.h" #include "nsIDOMText.h" @@ -30,16 +28,18 @@ #include "nsTextFrame.h" #include "nsFontFaceList.h" #include "mozilla/dom/DocumentFragment.h" +#include "mozilla/dom/DocumentType.h" #include "mozilla/dom/RangeBinding.h" #include "mozilla/Telemetry.h" #include "mozilla/Likely.h" using namespace mozilla; +using namespace mozilla::dom; JSObject* nsRange::WrapObject(JSContext* aCx, JS::Handle aScope) { - return dom::RangeBinding::Wrap(aCx, aScope, this); + return RangeBinding::Wrap(aCx, aScope, this); } /****************************************************** @@ -209,7 +209,7 @@ nsRange::~nsRange() // we want the side effects (releases and list removals) DoSetRange(nullptr, 0, nullptr, 0, nullptr); -} +} /* static */ nsresult @@ -529,13 +529,13 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument, // point before the first child is never affected by normalize().) nsINode* parentNode = aContent->GetParentNode(); if (parentNode == mStartParent && mStartOffset > 0 && - mStartOffset < parentNode->GetChildCount() && + uint32_t(mStartOffset) < parentNode->GetChildCount() && removed == parentNode->GetChildAt(mStartOffset)) { newStartNode = aContent; newStartOffset = aInfo->mChangeStart; } if (parentNode == mEndParent && mEndOffset > 0 && - mEndOffset < parentNode->GetChildCount() && + uint32_t(mEndOffset) < parentNode->GetChildCount() && removed == parentNode->GetChildAt(mEndOffset)) { newEndNode = aContent; newEndOffset = aInfo->mChangeEnd; @@ -921,18 +921,6 @@ IndexOf(nsINode* aChild) return parent ? parent->IndexOf(aChild) : -1; } -static int32_t -IndexOf(nsIDOMNode* aChildNode) -{ - // convert node to nsIContent, so that we can find the child index - - nsCOMPtr child = do_QueryInterface(aChildNode); - if (!child) { - return -1; - } - return IndexOf(child); -} - nsINode* nsRange::GetCommonAncestor() const { @@ -1165,7 +1153,7 @@ nsRange::SetStart(nsINode* aParent, int32_t aOffset) } DoSetRange(aParent, aOffset, mEndParent, mEndOffset, mRoot); - + return NS_OK; } @@ -1423,8 +1411,8 @@ class MOZ_STACK_CLASS RangeSubtreeIterator nsCOMPtr mIter; RangeSubtreeIterState mIterState; - nsCOMPtr mStart; - nsCOMPtr mEnd; + nsCOMPtr mStart; + nsCOMPtr mEnd; public: @@ -1436,8 +1424,8 @@ class MOZ_STACK_CLASS RangeSubtreeIterator { } - nsresult Init(nsIDOMRange *aRange); - already_AddRefed GetCurrentNode(); + nsresult Init(nsRange *aRange); + already_AddRefed GetCurrentNode(); void First(); void Last(); void Next(); @@ -1450,54 +1438,37 @@ class MOZ_STACK_CLASS RangeSubtreeIterator }; nsresult -RangeSubtreeIterator::Init(nsIDOMRange *aRange) +RangeSubtreeIterator::Init(nsRange *aRange) { mIterState = eDone; - bool collapsed; - aRange->GetCollapsed(&collapsed); - if (collapsed) { + if (aRange->Collapsed()) { return NS_OK; } - nsCOMPtr node; - // Grab the start point of the range and QI it to // a CharacterData pointer. If it is CharacterData store // a pointer to the node. - nsresult res = aRange->GetStartContainer(getter_AddRefs(node)); + ErrorResult rv; + nsCOMPtr node = aRange->GetStartContainer(rv); if (!node) return NS_ERROR_FAILURE; nsCOMPtr startData = do_QueryInterface(node); - if (startData) { + if (startData || (node->IsElement() && + node->AsElement()->GetChildCount() == aRange->GetStartOffset(rv))) { mStart = node; - } else { - int32_t startIndex; - aRange->GetStartOffset(&startIndex); - nsCOMPtr iNode = do_QueryInterface(node); - if (iNode->IsElement() && - int32_t(iNode->AsElement()->GetChildCount()) == startIndex) { - mStart = node; - } } // Grab the end point of the range and QI it to // a CharacterData pointer. If it is CharacterData store // a pointer to the node. - res = aRange->GetEndContainer(getter_AddRefs(node)); + node = aRange->GetEndContainer(rv); if (!node) return NS_ERROR_FAILURE; nsCOMPtr endData = do_QueryInterface(node); - if (endData) { + if (endData || (node->IsElement() && aRange->GetEndOffset(rv) == 0)) { mEnd = node; - } else { - int32_t endIndex; - aRange->GetEndOffset(&endIndex); - nsCOMPtr iNode = do_QueryInterface(node); - if (iNode->IsElement() && endIndex == 0) { - mEnd = node; - } } if (mStart && mStart == mEnd) @@ -1515,7 +1486,7 @@ RangeSubtreeIterator::Init(nsIDOMRange *aRange) mIter = NS_NewContentSubtreeIterator(); - res = mIter->Init(aRange); + nsresult res = mIter->Init(aRange); if (NS_FAILED(res)) return res; if (mIter->IsDone()) @@ -1536,17 +1507,17 @@ RangeSubtreeIterator::Init(nsIDOMRange *aRange) return NS_OK; } -already_AddRefed +already_AddRefed RangeSubtreeIterator::GetCurrentNode() { - nsCOMPtr node; + nsCOMPtr node; if (mIterState == eUseStart && mStart) { node = mStart; } else if (mIterState == eUseEnd && mEnd) { node = mEnd; } else if (mIterState == eUseIterator && mIter) { - node = do_QueryInterface(mIter->GetCurrentNode()); + node = mIter->GetCurrentNode(); } return node.forget(); @@ -1662,17 +1633,12 @@ RangeSubtreeIterator::Prev() // no content between the 2 end points. static nsresult -CollapseRangeAfterDelete(nsIDOMRange *aRange) +CollapseRangeAfterDelete(nsRange* aRange) { NS_ENSURE_ARG_POINTER(aRange); // Check if range gravity took care of collapsing the range for us! - - bool isCollapsed = false; - nsresult res = aRange->GetCollapsed(&isCollapsed); - if (NS_FAILED(res)) return res; - - if (isCollapsed) + if (aRange->Collapsed()) { // aRange is collapsed so there's nothing for us to do. // @@ -1692,17 +1658,14 @@ CollapseRangeAfterDelete(nsIDOMRange *aRange) // aRange isn't collapsed so figure out the appropriate place to collapse! // First get both end points and their common ancestor. - nsCOMPtr commonAncestor; - res = aRange->GetCommonAncestorContainer(getter_AddRefs(commonAncestor)); - if(NS_FAILED(res)) return res; - - nsCOMPtr startContainer, endContainer; - - res = aRange->GetStartContainer(getter_AddRefs(startContainer)); - if (NS_FAILED(res)) return res; + ErrorResult rv; + nsCOMPtr commonAncestor = aRange->GetCommonAncestorContainer(rv); + if (rv.Failed()) return rv.ErrorCode(); - res = aRange->GetEndContainer(getter_AddRefs(endContainer)); - if (NS_FAILED(res)) return res; + nsCOMPtr startContainer = aRange->GetStartContainer(rv); + if (rv.Failed()) return rv.ErrorCode(); + nsCOMPtr endContainer = aRange->GetEndContainer(rv); + if (rv.Failed()) return rv.ErrorCode(); // Collapse to one of the end points if they are already in the // commonAncestor. This should work ok since this method is called @@ -1718,13 +1681,11 @@ CollapseRangeAfterDelete(nsIDOMRange *aRange) // point that is between the 2 subtrees that contain each point, // under the common ancestor. - nsCOMPtr nodeToSelect(startContainer), parent; + nsCOMPtr nodeToSelect(startContainer); while (nodeToSelect) { - nsresult res = nodeToSelect->GetParentNode(getter_AddRefs(parent)); - if (NS_FAILED(res)) return res; - + nsCOMPtr parent = nodeToSelect->GetParentNode(); if (parent == commonAncestor) break; // We found the nodeToSelect! @@ -1734,8 +1695,8 @@ CollapseRangeAfterDelete(nsIDOMRange *aRange) if (!nodeToSelect) return NS_ERROR_FAILURE; // This should never happen! - res = aRange->SelectNode(nodeToSelect); - if (NS_FAILED(res)) return res; + aRange->SelectNode(*nodeToSelect, rv); + if (rv.Failed()) return rv.ErrorCode(); return aRange->Collapse(false); } @@ -1767,11 +1728,12 @@ static nsresult SplitDataNode(nsIDOMCharacterData* aStartNode, } NS_IMETHODIMP -PrependChild(nsIDOMNode* aParent, nsIDOMNode* aChild) +PrependChild(nsINode* aParent, nsINode* aChild) { - nsCOMPtr first, tmpNode; - aParent->GetFirstChild(getter_AddRefs(first)); - return aParent->InsertBefore(aChild, first, getter_AddRefs(tmpNode)); + nsCOMPtr first = aParent->GetFirstChild(); + ErrorResult rv; + aParent->InsertBefore(*aChild, first, rv); + return rv.ErrorCode(); } // Helper function for CutContents, making sure that the current node wasn't @@ -1780,14 +1742,12 @@ static bool ValidateCurrentNode(nsRange* aRange, RangeSubtreeIterator& aIter) { bool before, after; - nsCOMPtr domNode = aIter.GetCurrentNode(); - if (!domNode) { + nsCOMPtr node = aIter.GetCurrentNode(); + if (!node) { // We don't have to worry that the node was removed if it doesn't exist, // e.g., the iterator is done. return true; } - nsCOMPtr node = do_QueryInterface(domNode); - MOZ_ASSERT(node); nsresult res = nsRange::CompareNodeToRange(node, aRange, &before, &after); @@ -1795,24 +1755,24 @@ ValidateCurrentNode(nsRange* aRange, RangeSubtreeIterator& aIter) } nsresult -nsRange::CutContents(dom::DocumentFragment** aFragment) -{ +nsRange::CutContents(DocumentFragment** aFragment) +{ if (aFragment) { *aFragment = nullptr; } nsCOMPtr doc = mStartParent->OwnerDoc(); - nsCOMPtr commonAncestor; - nsresult rv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor)); - NS_ENSURE_SUCCESS(rv, rv); + ErrorResult res; + nsCOMPtr commonAncestor = GetCommonAncestorContainer(res); + NS_ENSURE_SUCCESS(res.ErrorCode(), res.ErrorCode()); // If aFragment isn't null, create a temporary fragment to hold our return. - nsRefPtr retval; + nsRefPtr retval; if (aFragment) { - retval = new dom::DocumentFragment(doc->NodeInfoManager()); + retval = new DocumentFragment(doc->NodeInfoManager()); } - nsCOMPtr commonCloneAncestor = retval.get(); + nsCOMPtr commonCloneAncestor = retval.get(); // Batch possible DOMSubtreeModified events. mozAutoSubtreeModified subtree(mRoot ? mRoot->OwnerDoc(): nullptr, nullptr); @@ -1820,25 +1780,23 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) // Save the range end points locally to avoid interference // of Range gravity during our edits! - nsCOMPtr startContainer = do_QueryInterface(mStartParent); + nsCOMPtr startContainer = mStartParent; int32_t startOffset = mStartOffset; - nsCOMPtr endContainer = do_QueryInterface(mEndParent); + nsCOMPtr endContainer = mEndParent; int32_t endOffset = mEndOffset; if (retval) { // For extractContents(), abort early if there's a doctype (bug 719533). // This can happen only if the common ancestor is a document, in which case // we just need to find its doctype child and check if that's in the range. - nsCOMPtr commonAncestorDocument(do_QueryInterface(commonAncestor)); + nsCOMPtr commonAncestorDocument = do_QueryInterface(commonAncestor); if (commonAncestorDocument) { - nsCOMPtr doctype; - rv = commonAncestorDocument->GetDoctype(getter_AddRefs(doctype)); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr doctype = commonAncestorDocument->GetDoctype(); if (doctype && nsContentUtils::ComparePoints(startContainer, startOffset, - doctype.get(), 0) < 0 && - nsContentUtils::ComparePoints(doctype.get(), 0, + doctype, 0) < 0 && + nsContentUtils::ComparePoints(doctype, 0, endContainer, endOffset) < 0) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } @@ -1850,7 +1808,7 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) RangeSubtreeIterator iter; - rv = iter.Init(this); + nsresult rv = iter.Init(this); if (NS_FAILED(rv)) return rv; if (iter.IsDone()) @@ -1875,8 +1833,8 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) while (!iter.IsDone()) { - nsCOMPtr nodeToResult; - nsCOMPtr node(iter.GetCurrentNode()); + nsCOMPtr nodeToResult; + nsCOMPtr node = iter.GetCurrentNode(); // Before we delete anything, advance the iterator to the // next subtree. @@ -1915,7 +1873,7 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) rv = charData->CloneNode(false, 1, getter_AddRefs(clone)); NS_ENSURE_SUCCESS(rv, rv); clone->SetNodeValue(cutValue); - nodeToResult = clone; + nodeToResult = do_QueryInterface(clone); } nsMutationGuard guard; @@ -1942,7 +1900,7 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_STATE(!guard.Mutated(1) || ValidateCurrentNode(this, iter)); - nodeToResult = cutNode; + nodeToResult = do_QueryInterface(cutNode); } handled = true; @@ -1964,26 +1922,24 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_STATE(!guard.Mutated(1) || ValidateCurrentNode(this, iter)); - nodeToResult = cutNode; + nodeToResult = do_QueryInterface(cutNode); } handled = true; - } + } } if (!handled && (node == endContainer || node == startContainer)) { - nsCOMPtr iNode = do_QueryInterface(node); - if (iNode && iNode->IsElement() && + if (node && node->IsElement() && ((node == endContainer && endOffset == 0) || (node == startContainer && - int32_t(iNode->AsElement()->GetChildCount()) == startOffset))) + int32_t(node->AsElement()->GetChildCount()) == startOffset))) { if (retval) { - nsCOMPtr clone; - rv = node->CloneNode(false, 1, getter_AddRefs(clone)); - NS_ENSURE_SUCCESS(rv, rv); - nodeToResult = clone; + ErrorResult rv; + nodeToResult = node->CloneNode(false, rv); + NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode()); } handled = true; } @@ -1997,33 +1953,30 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) } uint32_t parentCount = 0; - nsCOMPtr tmpNode; // Set the result to document fragment if we have 'retval'. if (retval) { - nsCOMPtr oldCommonAncestor = commonAncestor; + nsCOMPtr oldCommonAncestor = commonAncestor; if (!iter.IsDone()) { // Setup the parameters for the next iteration of the loop. - nsCOMPtr prevNode(iter.GetCurrentNode()); + nsCOMPtr prevNode = iter.GetCurrentNode(); NS_ENSURE_STATE(prevNode); // Get node's and prevNode's common parent. Do this before moving // nodes from original DOM to result fragment. - nsContentUtils::GetCommonAncestor(node, prevNode, - getter_AddRefs(commonAncestor)); + commonAncestor = nsContentUtils::GetCommonAncestor(node, prevNode); NS_ENSURE_STATE(commonAncestor); - nsCOMPtr parentCounterNode = node; + nsCOMPtr parentCounterNode = node; while (parentCounterNode && parentCounterNode != commonAncestor) { ++parentCount; - tmpNode = parentCounterNode; - tmpNode->GetParentNode(getter_AddRefs(parentCounterNode)); + parentCounterNode = parentCounterNode->GetParentNode(); NS_ENSURE_STATE(parentCounterNode); } } // Clone the parent hierarchy between commonAncestor and node. - nsCOMPtr closestAncestor, farthestAncestor; + nsCOMPtr closestAncestor, farthestAncestor; rv = CloneParentsBetween(oldCommonAncestor, node, getter_AddRefs(closestAncestor), getter_AddRefs(farthestAncestor)); @@ -2031,13 +1984,13 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) if (farthestAncestor) { - rv = PrependChild(commonCloneAncestor, farthestAncestor); + nsCOMPtr n = do_QueryInterface(commonCloneAncestor); + rv = PrependChild(n, farthestAncestor); NS_ENSURE_SUCCESS(rv, rv); } nsMutationGuard guard; - nsCOMPtr parent; - nodeToResult->GetParentNode(getter_AddRefs(parent)); + nsCOMPtr parent = nodeToResult->GetParentNode(); rv = closestAncestor ? PrependChild(closestAncestor, nodeToResult) : PrependChild(commonCloneAncestor, nodeToResult); NS_ENSURE_SUCCESS(rv, rv); @@ -2045,7 +1998,7 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) ValidateCurrentNode(this, iter)); } else if (nodeToResult) { nsMutationGuard guard; - nsCOMPtr node = do_QueryInterface(nodeToResult); + nsCOMPtr node = nodeToResult; nsINode* parent = node->GetParentNode(); if (parent) { mozilla::ErrorResult error; @@ -2058,11 +2011,10 @@ nsRange::CutContents(dom::DocumentFragment** aFragment) if (!iter.IsDone() && retval) { // Find the equivalent of commonAncestor in the cloned tree. - nsCOMPtr newCloneAncestor = nodeToResult; + nsCOMPtr newCloneAncestor = nodeToResult; for (uint32_t i = parentCount; i; --i) { - tmpNode = newCloneAncestor; - tmpNode->GetParentNode(getter_AddRefs(newCloneAncestor)); + newCloneAncestor = newCloneAncestor->GetParentNode(); NS_ENSURE_STATE(newCloneAncestor); } commonCloneAncestor = newCloneAncestor; @@ -2092,16 +2044,16 @@ NS_IMETHODIMP nsRange::ExtractContents(nsIDOMDocumentFragment** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); - nsRefPtr fragment; + nsRefPtr fragment; nsresult rv = CutContents(getter_AddRefs(fragment)); fragment.forget(aReturn); return rv; } -already_AddRefed +already_AddRefed nsRange::ExtractContents(ErrorResult& rv) { - nsRefPtr fragment; + nsRefPtr fragment; rv = CutContents(getter_AddRefs(fragment)); return fragment.forget(); } @@ -2171,10 +2123,10 @@ nsRange::CompareBoundaryPoints(uint16_t aHow, nsRange& aOtherRange, } /* static */ nsresult -nsRange::CloneParentsBetween(nsIDOMNode *aAncestor, - nsIDOMNode *aNode, - nsIDOMNode **aClosestAncestor, - nsIDOMNode **aFarthestAncestor) +nsRange::CloneParentsBetween(nsINode *aAncestor, + nsINode *aNode, + nsINode **aClosestAncestor, + nsINode **aFarthestAncestor) { NS_ENSURE_ARG_POINTER((aAncestor && aNode && aClosestAncestor && aFarthestAncestor)); @@ -2184,32 +2136,31 @@ nsRange::CloneParentsBetween(nsIDOMNode *aAncestor, if (aAncestor == aNode) return NS_OK; - nsCOMPtr parent, firstParent, lastParent; - - nsresult res = aNode->GetParentNode(getter_AddRefs(parent)); + nsCOMPtr firstParent, lastParent; + nsCOMPtr parent = aNode->GetParentNode(); while(parent && parent != aAncestor) { - nsCOMPtr clone, tmpNode; + ErrorResult rv; + nsCOMPtr clone = parent->CloneNode(false, rv); - res = parent->CloneNode(false, 1, getter_AddRefs(clone)); - - if (NS_FAILED(res)) return res; - if (!clone) return NS_ERROR_FAILURE; + if (rv.Failed()) { + return rv.ErrorCode(); + } + if (!clone) { + return NS_ERROR_FAILURE; + } - if (! firstParent) + if (! firstParent) { firstParent = lastParent = clone; - else - { - res = clone->AppendChild(lastParent, getter_AddRefs(tmpNode)); - - if (NS_FAILED(res)) return res; + } else { + clone->AppendChild(*lastParent, rv); + if (rv.Failed()) return rv.ErrorCode(); lastParent = clone; } - tmpNode = parent; - res = tmpNode->GetParentNode(getter_AddRefs(parent)); + parent = parent->GetParentNode(); } *aClosestAncestor = firstParent; @@ -2229,17 +2180,15 @@ nsRange::CloneContents(nsIDOMDocumentFragment** aReturn) return rv.ErrorCode(); } -already_AddRefed +already_AddRefed nsRange::CloneContents(ErrorResult& aRv) { - nsCOMPtr commonAncestor; - aRv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor)); + nsCOMPtr commonAncestor = GetCommonAncestorContainer(aRv); MOZ_ASSERT(!aRv.Failed(), "GetCommonAncestorContainer() shouldn't fail!"); - nsCOMPtr document = - do_QueryInterface(mStartParent->OwnerDoc()); - NS_ASSERTION(document, "CloneContents needs a document to continue."); - if (!document) { + nsCOMPtr doc = mStartParent->OwnerDoc(); + NS_ASSERTION(doc, "CloneContents needs a document to continue."); + if (!doc) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } @@ -2248,16 +2197,10 @@ nsRange::CloneContents(ErrorResult& aRv) // which might be null - nsCOMPtr doc(do_QueryInterface(document)); + nsRefPtr clonedFrag = + new DocumentFragment(doc->NodeInfoManager()); - nsRefPtr clonedFrag = - new dom::DocumentFragment(doc->NodeInfoManager()); - - nsCOMPtr commonCloneAncestor = clonedFrag.get(); - if (!commonCloneAncestor) { - aRv.Throw(NS_ERROR_FAILURE); - return nullptr; - } + nsCOMPtr commonCloneAncestor = clonedFrag.get(); // Create and initialize a subtree iterator that will give // us all the subtrees within the range. @@ -2289,18 +2232,16 @@ nsRange::CloneContents(ErrorResult& aRv) while (!iter.IsDone()) { - nsCOMPtr node(iter.GetCurrentNode()); - nsCOMPtr iNode = do_QueryInterface(node); - bool deepClone = !iNode->IsElement() || - (!(iNode == mEndParent && mEndOffset == 0) && - !(iNode == mStartParent && + nsCOMPtr node = iter.GetCurrentNode(); + bool deepClone = !node->IsElement() || + (!(node == mEndParent && mEndOffset == 0) && + !(node == mStartParent && mStartOffset == - int32_t(iNode->AsElement()->GetChildCount()))); + int32_t(node->AsElement()->GetChildCount()))); // Clone the current subtree! - nsCOMPtr clone; - aRv = node->CloneNode(deepClone, 1, getter_AddRefs(clone)); + nsCOMPtr clone = node->CloneNode(deepClone, aRv); if (aRv.Failed()) { return nullptr; } @@ -2315,7 +2256,7 @@ nsRange::CloneContents(ErrorResult& aRv) if (charData) { - if (iNode == mEndParent) + if (node == mEndParent) { // We only need the data before mEndOffset, so get rid of any // data after it. @@ -2333,9 +2274,9 @@ nsRange::CloneContents(ErrorResult& aRv) return nullptr; } } - } + } - if (iNode == mStartParent) + if (node == mStartParent) { // We don't need any data before mStartOffset, so just // delete it! @@ -2352,7 +2293,7 @@ nsRange::CloneContents(ErrorResult& aRv) // Clone the parent hierarchy between commonAncestor and node. - nsCOMPtr closestAncestor, farthestAncestor; + nsCOMPtr closestAncestor, farthestAncestor; aRv = CloneParentsBetween(commonAncestor, node, getter_AddRefs(closestAncestor), @@ -2364,12 +2305,9 @@ nsRange::CloneContents(ErrorResult& aRv) // Hook the parent hierarchy/context of the subtree into the clone tree. - nsCOMPtr tmpNode; - if (farthestAncestor) { - aRv = commonCloneAncestor->AppendChild(farthestAncestor, - getter_AddRefs(tmpNode)); + commonCloneAncestor->AppendChild(*farthestAncestor, aRv); if (aRv.Failed()) { return nullptr; @@ -2378,19 +2316,20 @@ nsRange::CloneContents(ErrorResult& aRv) // Place the cloned subtree into the cloned doc frag tree! + nsCOMPtr cloneNode = do_QueryInterface(clone); if (closestAncestor) { // Append the subtree under closestAncestor since it is the // immediate parent of the subtree. - aRv = closestAncestor->AppendChild(clone, getter_AddRefs(tmpNode)); + closestAncestor->AppendChild(*cloneNode, aRv); } else { - // If we get here, there is no missing parent hierarchy between + // If we get here, there is no missing parent hierarchy between // commonAncestor and node, so just append clone to commonCloneAncestor. - aRv = commonCloneAncestor->AppendChild(clone, getter_AddRefs(tmpNode)); + commonCloneAncestor->AppendChild(*cloneNode, aRv); } if (aRv.Failed()) { return nullptr; @@ -2404,14 +2343,14 @@ nsRange::CloneContents(ErrorResult& aRv) if (iter.IsDone()) break; // We must be done! - nsCOMPtr nextNode(iter.GetCurrentNode()); + nsCOMPtr nextNode = iter.GetCurrentNode(); if (!nextNode) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } // Get node and nextNode's common parent. - nsContentUtils::GetCommonAncestor(node, nextNode, getter_AddRefs(commonAncestor)); + commonAncestor = nsContentUtils::GetCommonAncestor(node, nextNode); if (!commonAncestor) { aRv.Throw(NS_ERROR_FAILURE); @@ -2422,8 +2361,7 @@ nsRange::CloneContents(ErrorResult& aRv) while (node && node != commonAncestor) { - tmpNode = node; - aRv = tmpNode->GetParentNode(getter_AddRefs(node)); + node = node->GetParentNode(); if (aRv.Failed()) { return nullptr; } @@ -2433,19 +2371,14 @@ nsRange::CloneContents(ErrorResult& aRv) return nullptr; } - tmpNode = clone; - aRv = tmpNode->GetParentNode(getter_AddRefs(clone)); - if (aRv.Failed()) { - return nullptr; - } - - if (!clone) { + cloneNode = cloneNode->GetParentNode(); + if (!cloneNode) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } } - commonCloneAncestor = clone; + commonCloneAncestor = cloneNode; } return clonedFrag.forget(); @@ -2493,24 +2426,19 @@ nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv) int32_t tStartOffset = StartOffset(); - nsCOMPtr tStartContainer; - aRv = this->GetStartContainer(getter_AddRefs(tStartContainer)); + nsCOMPtr tStartContainer = GetStartContainer(aRv); if (aRv.Failed()) { return; } // This is the node we'll be inserting before, and its parent - nsCOMPtr referenceNode; - nsCOMPtr referenceParentNode = tStartContainer; + nsCOMPtr referenceNode; + nsCOMPtr referenceParentNode = tStartContainer; nsCOMPtr startTextNode(do_QueryInterface(tStartContainer)); nsCOMPtr tChildList; if (startTextNode) { - aRv = tStartContainer->GetParentNode(getter_AddRefs(referenceParentNode)); - if (aRv.Failed()) { - return; - } - + referenceParentNode = tStartContainer->GetParentNode(); if (!referenceParentNode) { aRv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); return; @@ -2522,15 +2450,17 @@ nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv) return; } - referenceNode = secondPart; + referenceNode = do_QueryInterface(secondPart); } else { - aRv = tStartContainer->GetChildNodes(getter_AddRefs(tChildList)); + aRv = tStartContainer->AsDOMNode()->GetChildNodes(getter_AddRefs(tChildList)); if (aRv.Failed()) { return; } // find the insertion point in the DOM and insert the Node - aRv = tChildList->Item(tStartOffset, getter_AddRefs(referenceNode)); + nsCOMPtr q; + aRv = tChildList->Item(tStartOffset, getter_AddRefs(q)); + referenceNode = do_QueryInterface(q); if (aRv.Failed()) { return; } @@ -2560,13 +2490,8 @@ nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv) } // Now actually insert the node - nsCOMPtr tResultNode; - nsCOMPtr node = aNode.AsDOMNode(); - if (!node) { - aRv.Throw(NS_ERROR_DOM_NOT_OBJECT_ERR); - return; - } - aRv = referenceParentNode->InsertBefore(node, referenceNode, getter_AddRefs(tResultNode)); + nsCOMPtr tResultNode; + tResultNode = referenceParentNode->InsertBefore(aNode, referenceNode, aRv); if (aRv.Failed()) { return; } @@ -2633,9 +2558,7 @@ nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv) // Extract the contents within the range. - nsCOMPtr docFrag; - - aRv = ExtractContents(getter_AddRefs(docFrag)); + nsRefPtr docFrag = ExtractContents(aRv); if (aRv.Failed()) { return; @@ -2657,8 +2580,6 @@ nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv) uint32_t numChildren = children->Length(); - nsCOMPtr tmpNode; - while (numChildren) { nsCOMPtr child = children->Item(--numChildren); @@ -2681,7 +2602,7 @@ nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv) } // Append the content we extracted under aNewParent. - aRv = aNewParent.AsDOMNode()->AppendChild(docFrag, getter_AddRefs(tmpNode)); + aNewParent.AppendChild(*docFrag, aRv); if (aRv.Failed()) { return; } @@ -2693,10 +2614,10 @@ nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv) NS_IMETHODIMP nsRange::ToString(nsAString& aReturn) -{ +{ // clear the string aReturn.Truncate(); - + // If we're unpositioned, return the empty string if (!mIsPositioned) { return NS_OK; @@ -2705,12 +2626,12 @@ nsRange::ToString(nsAString& aReturn) #ifdef DEBUG_range printf("Range dump: -----------------------\n"); #endif /* DEBUG */ - + // effeciency hack for simple case if (mStartParent == mEndParent) { nsCOMPtr textNode( do_QueryInterface(mStartParent) ); - + if (textNode) { #ifdef DEBUG_range @@ -2725,8 +2646,8 @@ nsRange::ToString(nsAString& aReturn) return NS_ERROR_UNEXPECTED; return NS_OK; } - } - + } + /* complex case: mStartParent != mEndParent, or mStartParent not a text node revisit - there are potential optimizations here and also tradeoffs. */ @@ -2734,9 +2655,9 @@ nsRange::ToString(nsAString& aReturn) nsCOMPtr iter = NS_NewContentIterator(); nsresult rv = iter->Init(this); NS_ENSURE_SUCCESS(rv, rv); - + nsString tempString; - + // loop through the content iterator, which returns nodes in the range in // close tag order, and grab the text from any text node while (!iter->IsDone()) @@ -2788,7 +2709,7 @@ nsRange::Detach() return NS_OK; } -NS_IMETHODIMP +NS_IMETHODIMP nsRange::CreateContextualFragment(const nsAString& aFragment, nsIDOMDocumentFragment** aReturn) { @@ -2799,7 +2720,7 @@ nsRange::CreateContextualFragment(const nsAString& aFragment, return NS_ERROR_FAILURE; } -already_AddRefed +already_AddRefed nsRange::CreateContextualFragment(const nsAString& aFragment, ErrorResult& aRv) { if (!mIsPositioned) { @@ -2864,14 +2785,14 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback, return NS_OK; } -static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector, +static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector, nsRange* aRange, nsINode* aStartParent, int32_t aStartOffset, nsINode* aEndParent, int32_t aEndOffset) { // Hold strong pointers across the flush - nsCOMPtr startContainer = do_QueryInterface(aStartParent); - nsCOMPtr endContainer = do_QueryInterface(aEndParent); + nsCOMPtr startContainer = aStartParent; + nsCOMPtr endContainer = aEndParent; // Flush out layout so our frames are up to date. if (!aStartParent->IsInDoc()) { @@ -2902,7 +2823,7 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector, textFrame->GetChildFrameContainingOffset(aStartOffset, false, &outOffset, &outFrame); if (outFrame) { - nsIFrame* relativeTo = + nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(outFrame); nsRect r(outFrame->GetOffsetTo(relativeTo), outFrame->GetSize()); ExtractRectFromOffset(outFrame, relativeTo, aStartOffset, &r, false); @@ -2915,14 +2836,14 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector, } do { - nsCOMPtr node(iter.GetCurrentNode()); + nsCOMPtr node = iter.GetCurrentNode(); iter.Next(); nsCOMPtr content = do_QueryInterface(node); if (!content) continue; if (content->IsNodeOfType(nsINode::eTEXT)) { if (node == startContainer) { - int32_t offset = startContainer == endContainer ? + int32_t offset = startContainer == endContainer ? aEndOffset : content->GetText()->GetLength(); GetPartialTextRect(aCollector, content, aStartOffset, offset); continue; @@ -2996,8 +2917,8 @@ nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult) NS_ENSURE_TRUE(mStartParent, NS_ERROR_UNEXPECTED); - nsCOMPtr startContainer = do_QueryInterface(mStartParent); - nsCOMPtr endContainer = do_QueryInterface(mEndParent); + nsCOMPtr startContainer = do_QueryInterface(mStartParent); + nsCOMPtr endContainer = do_QueryInterface(mEndParent); // Flush out layout so our frames are up to date. nsIDocument* doc = mStartParent->OwnerDoc(); @@ -3015,7 +2936,7 @@ nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult) while (!iter.IsDone()) { // only collect anything if the range is not collapsed - nsCOMPtr node(iter.GetCurrentNode()); + nsCOMPtr node = iter.GetCurrentNode(); iter.Next(); nsCOMPtr content = do_QueryInterface(node); @@ -3029,7 +2950,7 @@ nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult) if (content->IsNodeOfType(nsINode::eTEXT)) { if (node == startContainer) { - int32_t offset = startContainer == endContainer ? + int32_t offset = startContainer == endContainer ? mEndOffset : content->GetText()->GetLength(); nsLayoutUtils::GetFontFacesForText(frame, mStartOffset, offset, true, fontFaceList); @@ -3085,7 +3006,7 @@ nsRange::AutoInvalidateSelection::~AutoInvalidateSelection() } /* static */ already_AddRefed -nsRange::Constructor(const dom::GlobalObject& aGlobal, ErrorResult& aRv) +nsRange::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) { nsCOMPtr window = do_QueryInterface(aGlobal.Get()); if (!window || !window->GetDoc()) { diff --git a/content/base/src/nsRange.h b/content/base/src/nsRange.h index 92ba98861ba2..4fa815293a2e 100644 --- a/content/base/src/nsRange.h +++ b/content/base/src/nsRange.h @@ -22,7 +22,6 @@ class nsClientRect; class nsClientRectList; -class nsIDOMDocumentFragment; namespace mozilla { class ErrorResult; @@ -89,7 +88,7 @@ class nsRange MOZ_FINAL : public nsIDOMRange, // nsIDOMRange interface NS_DECL_NSIDOMRANGE - + nsINode* GetRoot() const { return mRoot; @@ -235,16 +234,16 @@ class nsRange MOZ_FINAL : public nsIDOMRange, */ nsresult CutContents(mozilla::dom::DocumentFragment** frag); - static nsresult CloneParentsBetween(nsIDOMNode *aAncestor, - nsIDOMNode *aNode, - nsIDOMNode **aClosestAncestor, - nsIDOMNode **aFarthestAncestor); + static nsresult CloneParentsBetween(nsINode* aAncestor, + nsINode* aNode, + nsINode** aClosestAncestor, + nsINode** aFarthestAncestor); public: /****************************************************************************** - * Utility routine to detect if a content node starts before a range and/or + * Utility routine to detect if a content node starts before a range and/or * ends after a range. If neither it is contained inside the range. - * + * * XXX - callers responsibility to ensure node in same doc as range! * *****************************************************************************/ diff --git a/content/base/src/nsTextNode.cpp b/content/base/src/nsTextNode.cpp index e00c182a869f..1af16a61ad4a 100644 --- a/content/base/src/nsTextNode.cpp +++ b/content/base/src/nsTextNode.cpp @@ -26,8 +26,8 @@ using namespace mozilla::dom; /** * class used to implement attr() generated content */ -class nsAttributeTextNode : public nsTextNode, - public nsStubMutationObserver +class nsAttributeTextNode MOZ_FINAL : public nsTextNode, + public nsStubMutationObserver { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/content/base/test/chrome/title_window.xul b/content/base/test/chrome/title_window.xul index 88bae491baff..da2ee24b67ac 100644 --- a/content/base/test/chrome/title_window.xul +++ b/content/base/test/chrome/title_window.xul @@ -38,6 +38,10 @@ testStatic("xhtml3", "Test", "XHTML containing an element"); testStatic("xul1", "Test", "XUL <window> title attribute"); testStatic("svg1", "Test", "SVG <title>"); + + // This one does nothing and won't fire an event + document.getElementById("xhtml4").contentDocument.title = "Hello"; + is(document.getElementById("xhtml4").contentDocument.title, "", "Setting 'title' does nothing with no <head>"); } function testDynamics() { @@ -73,100 +77,116 @@ op(frame.contentDocument); } - testDynamic("html1", "Hello", "Setting HTML <title> text contents", - function(doc){ - var t = doc.getElementById("t"); t.textContent = "Hello"; - }); - testDynamic("html2", "Foo", "Removing HTML <title>", - function(doc){ - var t = doc.getElementById("t"); t.parentNode.removeChild(t); - }); - testDynamic("html3", "Hello", "Appending HTML <title> element to root element", - function(doc){ - var t = doc.createElement("title"); t.textContent = "Hello"; doc.documentElement.appendChild(t); - }); - - testDynamic("xhtml3", "Hello", "Setting 'title' clears existing <title> contents", - function(doc){ - doc.title = "Hello"; - }, - function(doc, desc) { - is(doc.documentElement.firstChild.data, "Hello", desc); - is(doc.documentElement.firstChild.nextSibling, null, desc); - }); - // This one does nothing and won't fire an event - document.getElementById("xhtml4").contentDocument.title = "Hello"; - is(document.getElementById("xhtml4").contentDocument.title, "", "Setting 'title' does nothing with no <head>"); - testDynamic("xhtml5", "Hello", "Setting 'title' works with a <head>", - function(doc){ - doc.title = "Hello"; - }, - function(doc, desc) { - var head = doc.documentElement.firstChild; - var title = head.firstChild; - is(title.tagName.toLowerCase(), "title", desc); - is(title.firstChild.data, "Hello", desc); - is(title.firstChild.nextSibling, null, desc); - is(title.nextSibling, null, desc); - }); - testDynamic("xhtml6", "Hello", "Setting 'title' appends to <head>", - function(doc){ - doc.title = "Hello"; - }, - function(doc, desc) { - var head = doc.documentElement.firstChild; - is(head.firstChild.tagName.toLowerCase(), "style", desc); - var title = head.firstChild.nextSibling; - is(title.tagName.toLowerCase(), "title", desc); - is(title.firstChild.data, "Hello", desc); - is(title.firstChild.nextSibling, null, desc); - is(title.nextSibling, null, desc); - }); - - testDynamic("xul1", "Hello", "Setting XUL <window> title attribute", - function(doc){ - doc.documentElement.setAttribute("title", "Hello"); - }); - testDynamic("xul2", "Hello", "Setting 'title' in XUL", - function(doc){ - doc.title = "Hello"; - }, - function(doc, desc) { - is(doc.documentElement.getAttribute("title"), "Hello", desc); - is(doc.documentElement.firstChild, null, desc); - }); - - testDynamic("svg1", "Hello", "Setting SVG <title> text contents", - function(doc){ - var t = doc.getElementById("t"); t.textContent = "Hello"; - }); - testDynamic("svg2", "", "Removing SVG <title>", - function(doc){ - var t = doc.getElementById("t"); t.parentNode.removeChild(t); - }); - - function end() { - for (description in inProgress) { - ok(!inProgress[description], - description + ": DOMTitleChange not fired"); - } - for (description in inProgressDoc) { - ok(inProgressDoc[description], - description + ": DOMTitleChange fired on content document"); - } - for (description in inProgressWin) { - ok(inProgressWin[description], - description + ": DOMTitleChange fired on content window"); - } + var dynamicTests = [ + [ "html1", "Hello", "Setting HTML <title> text contents", + function(doc){ + var t = doc.getElementById("t"); t.textContent = "Hello"; + } ], + [ "html2", "Foo", "Removing HTML <title>", + function(doc){ + var t = doc.getElementById("t"); t.parentNode.removeChild(t); + } ], + [ "html3", "Hello", "Appending HTML <title> element to root element", + function(doc){ + var t = doc.createElement("title"); t.textContent = "Hello"; doc.documentElement.appendChild(t); + } ], + [ "xhtml3", "Hello", "Setting 'title' clears existing <title> contents", + function(doc){ + doc.title = "Hello"; + }, + function(doc, desc) { + is(doc.documentElement.firstChild.data, "Hello", desc); + is(doc.documentElement.firstChild.nextSibling, null, desc); + } ], + [ "xhtml5", "Hello", "Setting 'title' works with a <head>", + function(doc){ + doc.title = "Hello"; + }, + function(doc, desc) { + var head = doc.documentElement.firstChild; + var title = head.firstChild; + is(title.tagName.toLowerCase(), "title", desc); + is(title.firstChild.data, "Hello", desc); + is(title.firstChild.nextSibling, null, desc); + is(title.nextSibling, null, desc); + } ], + [ "xhtml6", "Hello", "Setting 'title' appends to <head>", + function(doc){ + doc.title = "Hello"; + }, + function(doc, desc) { + var head = doc.documentElement.firstChild; + is(head.firstChild.tagName.toLowerCase(), "style", desc); + var title = head.firstChild.nextSibling; + is(title.tagName.toLowerCase(), "title", desc); + is(title.firstChild.data, "Hello", desc); + is(title.firstChild.nextSibling, null, desc); + is(title.nextSibling, null, desc); + } ], + [ "xul1", "Hello", "Setting XUL <window> title attribute", + function(doc){ + doc.documentElement.setAttribute("title", "Hello"); + } ], + [ "xul2", "Hello", "Setting 'title' in XUL", + function(doc){ + doc.title = "Hello"; + }, + function(doc, desc) { + is(doc.documentElement.getAttribute("title"), "Hello", desc); + is(doc.documentElement.firstChild, null, desc); + } ], + [ "svg1", "Hello", "Setting SVG <title> text contents", + function(doc){ + var t = doc.getElementById("t"); t.textContent = "Hello"; + } ], + [ "svg2", "", "Removing SVG <title>", + function(doc){ + var t = doc.getElementById("t"); t.parentNode.removeChild(t); + } ] ]; + + var titleWindow = window; + + function runIndividualTest(i) { + if (i == dynamicTests.length) { + // Closing the window will nuke the global properties, since this + // function is not really running on this window... or something + // like that. Thanks, executeSoon! + var tester = SimpleTest; + window.close(); + tester.finish(); + } else { + var parameters = dynamicTests[i]; + var testElementId = parameters[0]; + var testExpectedValue = parameters[1]; + var testDescription = parameters[2]; + var testOp = parameters[3]; + var testCheckDOM = parameters[4]; + + function checkTest() { + ok(!inProgress[testDescription], + testDescription + ": DOMTitleChange not fired"); + ok(inProgressDoc[testDescription], + testDescription + ": DOMTitleChange fired on content document"); + ok(inProgressWin[testDescription], + testDescription + ": DOMTitleChange fired on content window"); + // Run the next test in the context of the parent XUL window. + titleWindow.setTimeout(runIndividualTest, 0, i+1); + } + function spinEventLoopOp(doc) { + // Perform the test's operations. + testOp(doc); + // Spin the associated window's event loop to ensure we + // drain any asynchronous changes and fire associated + // events. + doc.defaultView.setTimeout(checkTest, 0); + } - // Closing the window will nuke the global properties, since this - // function is not really running on this window... or something - // like that. Thanks, executeSoon! - var tester = SimpleTest; - window.close(); - tester.finish(); + testDynamic(testElementId, testExpectedValue, testDescription, + spinEventLoopOp, testCheckDOM); + } } - SimpleTest.executeSoon(end); + + window.setTimeout(runIndividualTest, 0, 0); } function runTests() { diff --git a/content/canvas/src/Makefile.in b/content/canvas/src/Makefile.in index 02222034b320..33dd5329f425 100644 --- a/content/canvas/src/Makefile.in +++ b/content/canvas/src/Makefile.in @@ -21,9 +21,6 @@ LOCAL_INCLUDES += \ $(NULL) endif -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/content/canvas/test/webgl/moz.build b/content/canvas/test/webgl/moz.build index 895d11993cfb..3d5c1e93c6e7 100644 --- a/content/canvas/test/webgl/moz.build +++ b/content/canvas/test/webgl/moz.build @@ -4,3 +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/. +DIRS += ['non-conf-tests'] diff --git a/content/canvas/test/webgl/non-conf-tests/Makefile.in b/content/canvas/test/webgl/non-conf-tests/Makefile.in new file mode 100644 index 000000000000..4f97d3bb43ee --- /dev/null +++ b/content/canvas/test/webgl/non-conf-tests/Makefile.in @@ -0,0 +1,18 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DEPTH = @DEPTH@ +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = @relativesrcdir@ + +include $(DEPTH)/config/autoconf.mk + +MOCHITEST_FILES = \ + test_webgl_conformance.html \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/content/canvas/test/webgl/non-conf-tests/moz.build b/content/canvas/test/webgl/non-conf-tests/moz.build new file mode 100644 index 000000000000..c271ec3908ce --- /dev/null +++ b/content/canvas/test/webgl/non-conf-tests/moz.build @@ -0,0 +1,5 @@ +# -*- 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/content/canvas/test/webgl/non-conf-tests/test_webgl_conformance.html b/content/canvas/test/webgl/non-conf-tests/test_webgl_conformance.html new file mode 100644 index 000000000000..aad40652d938 --- /dev/null +++ b/content/canvas/test/webgl/non-conf-tests/test_webgl_conformance.html @@ -0,0 +1,26 @@ +<!DOCTYPE HTML> +<title>WebGL test: 'webgl' context request + + + + + + + diff --git a/content/events/src/Makefile.in b/content/events/src/Makefile.in index 4e075bdb99e9..02d732e8a473 100644 --- a/content/events/src/Makefile.in +++ b/content/events/src/Makefile.in @@ -15,9 +15,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index d9f8500ee924..eaa1093017df 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -12,7 +12,7 @@ #include "nsCxPusher.h" #include "nsError.h" #include "nsMutationEvent.h" -#include NEW_H +#include #include "nsINode.h" #include "nsPIDOMWindow.h" #include "nsFrameLoader.h" diff --git a/content/html/content/public/HTMLAudioElement.h b/content/html/content/public/HTMLAudioElement.h index 49fcd23e1c03..5434242be917 100644 --- a/content/html/content/public/HTMLAudioElement.h +++ b/content/html/content/public/HTMLAudioElement.h @@ -18,9 +18,9 @@ typedef uint16_t nsMediaReadyState; namespace mozilla { namespace dom { -class HTMLAudioElement : public HTMLMediaElement, - public nsITimerCallback, - public nsIDOMHTMLAudioElement +class HTMLAudioElement MOZ_FINAL : public HTMLMediaElement, + public nsITimerCallback, + public nsIDOMHTMLAudioElement { public: HTMLAudioElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/public/HTMLVideoElement.h b/content/html/content/public/HTMLVideoElement.h index a03119f01cc7..95047106d392 100644 --- a/content/html/content/public/HTMLVideoElement.h +++ b/content/html/content/public/HTMLVideoElement.h @@ -16,8 +16,8 @@ namespace mozilla { namespace dom { -class HTMLVideoElement : public HTMLMediaElement, - public nsIDOMHTMLVideoElement +class HTMLVideoElement MOZ_FINAL : public HTMLMediaElement, + public nsIDOMHTMLVideoElement { public: HTMLVideoElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLAnchorElement.h b/content/html/content/src/HTMLAnchorElement.h index cf43928344eb..4ce3f4330f1d 100644 --- a/content/html/content/src/HTMLAnchorElement.h +++ b/content/html/content/src/HTMLAnchorElement.h @@ -16,10 +16,10 @@ namespace mozilla { namespace dom { -class HTMLAnchorElement : public nsGenericHTMLElement, - public nsIDOMHTMLAnchorElement, - public nsILink, - public Link +class HTMLAnchorElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLAnchorElement, + public nsILink, + public Link { public: using Element::GetText; diff --git a/content/html/content/src/HTMLAreaElement.h b/content/html/content/src/HTMLAreaElement.h index 4a1b2928e61c..106de38ba1d4 100644 --- a/content/html/content/src/HTMLAreaElement.h +++ b/content/html/content/src/HTMLAreaElement.h @@ -20,10 +20,10 @@ class nsIDocument; namespace mozilla { namespace dom { -class HTMLAreaElement : public nsGenericHTMLElement, - public nsIDOMHTMLAreaElement, - public nsILink, - public Link +class HTMLAreaElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLAreaElement, + public nsILink, + public Link { public: HTMLAreaElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLBodyElement.h b/content/html/content/src/HTMLBodyElement.h index b105a053086b..c2d7a3c05565 100644 --- a/content/html/content/src/HTMLBodyElement.h +++ b/content/html/content/src/HTMLBodyElement.h @@ -33,8 +33,8 @@ class BodyRule: public nsIStyleRule HTMLBodyElement* mPart; // not ref-counted, cleared by content }; -class HTMLBodyElement : public nsGenericHTMLElement, - public nsIDOMHTMLBodyElement +class HTMLBodyElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLBodyElement { public: using Element::GetText; diff --git a/content/html/content/src/HTMLButtonElement.h b/content/html/content/src/HTMLButtonElement.h index 40757fd82c1f..640deeef7f1e 100644 --- a/content/html/content/src/HTMLButtonElement.h +++ b/content/html/content/src/HTMLButtonElement.h @@ -14,9 +14,9 @@ namespace mozilla { namespace dom { -class HTMLButtonElement : public nsGenericHTMLFormElement, - public nsIDOMHTMLButtonElement, - public nsIConstraintValidation +class HTMLButtonElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsIDOMHTMLButtonElement, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/content/html/content/src/HTMLDataListElement.h b/content/html/content/src/HTMLDataListElement.h index 10d0686dd74e..5d42896a1a17 100644 --- a/content/html/content/src/HTMLDataListElement.h +++ b/content/html/content/src/HTMLDataListElement.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class HTMLDataListElement : public nsGenericHTMLElement, - public nsIDOMHTMLDataListElement +class HTMLDataListElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLDataListElement { public: HTMLDataListElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLElement.cpp b/content/html/content/src/HTMLElement.cpp index 1a9b28c3782e..35b5ecbc3036 100644 --- a/content/html/content/src/HTMLElement.cpp +++ b/content/html/content/src/HTMLElement.cpp @@ -10,8 +10,8 @@ namespace mozilla { namespace dom { -class HTMLElement : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLElement { public: HTMLElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLFieldSetElement.h b/content/html/content/src/HTMLFieldSetElement.h index e3e06a7e7e07..c484d4d4e85e 100644 --- a/content/html/content/src/HTMLFieldSetElement.h +++ b/content/html/content/src/HTMLFieldSetElement.h @@ -16,9 +16,9 @@ namespace mozilla { namespace dom { -class HTMLFieldSetElement : public nsGenericHTMLFormElement, - public nsIDOMHTMLFieldSetElement, - public nsIConstraintValidation +class HTMLFieldSetElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsIDOMHTMLFieldSetElement, + public nsIConstraintValidation { public: using nsGenericHTMLFormElement::GetForm; diff --git a/content/html/content/src/HTMLFontElement.h b/content/html/content/src/HTMLFontElement.h index ee06456df718..61ed4d92facb 100644 --- a/content/html/content/src/HTMLFontElement.h +++ b/content/html/content/src/HTMLFontElement.h @@ -12,8 +12,8 @@ namespace mozilla { namespace dom { -class HTMLFontElement : public nsGenericHTMLElement, - public nsIDOMHTMLFontElement +class HTMLFontElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLFontElement { public: HTMLFontElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLFormElement.h b/content/html/content/src/HTMLFormElement.h index b5a04e0f494b..913a89a8d104 100644 --- a/content/html/content/src/HTMLFormElement.h +++ b/content/html/content/src/HTMLFormElement.h @@ -35,11 +35,11 @@ namespace dom { class nsFormControlList; -class HTMLFormElement : public nsGenericHTMLElement, - public nsIDOMHTMLFormElement, - public nsIWebProgressListener, - public nsIForm, - public nsIRadioGroupContainer +class HTMLFormElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLFormElement, + public nsIWebProgressListener, + public nsIForm, + public nsIRadioGroupContainer { friend class nsFormControlList; diff --git a/content/html/content/src/HTMLFrameElement.h b/content/html/content/src/HTMLFrameElement.h index effd3e0bc8fd..da06b9bf009d 100644 --- a/content/html/content/src/HTMLFrameElement.h +++ b/content/html/content/src/HTMLFrameElement.h @@ -16,8 +16,8 @@ class nsIDOMDocument; namespace mozilla { namespace dom { -class HTMLFrameElement : public nsGenericHTMLFrameElement, - public nsIDOMHTMLFrameElement +class HTMLFrameElement MOZ_FINAL : public nsGenericHTMLFrameElement, + public nsIDOMHTMLFrameElement { public: using nsGenericHTMLFrameElement::SwapFrameLoaders; diff --git a/content/html/content/src/HTMLFrameSetElement.h b/content/html/content/src/HTMLFrameSetElement.h index eb9cd2588813..2a82c82e7028 100644 --- a/content/html/content/src/HTMLFrameSetElement.h +++ b/content/html/content/src/HTMLFrameSetElement.h @@ -42,8 +42,8 @@ namespace dom { class BeforeUnloadEventHandlerNonNull; -class HTMLFrameSetElement : public nsGenericHTMLElement, - public nsIDOMHTMLFrameSetElement +class HTMLFrameSetElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLFrameSetElement { public: HTMLFrameSetElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLHRElement.h b/content/html/content/src/HTMLHRElement.h index 7116bea18c85..7c3a5d0b13fb 100644 --- a/content/html/content/src/HTMLHRElement.h +++ b/content/html/content/src/HTMLHRElement.h @@ -16,8 +16,8 @@ namespace mozilla { namespace dom { -class HTMLHRElement : public nsGenericHTMLElement, - public nsIDOMHTMLHRElement +class HTMLHRElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLHRElement { public: HTMLHRElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLInputElement.h b/content/html/content/src/HTMLInputElement.h index 632511d57d9d..005a16d08004 100644 --- a/content/html/content/src/HTMLInputElement.h +++ b/content/html/content/src/HTMLInputElement.h @@ -77,13 +77,13 @@ class UploadLastDir MOZ_FINAL : public nsIObserver, public nsSupportsWeakReferen }; }; -class HTMLInputElement : public nsGenericHTMLFormElement, - public nsImageLoadingContent, - public nsIDOMHTMLInputElement, - public nsITextControlElement, - public nsIPhonetic, - public nsIDOMNSEditableElement, - public nsIConstraintValidation +class HTMLInputElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsImageLoadingContent, + public nsIDOMHTMLInputElement, + public nsITextControlElement, + public nsIPhonetic, + public nsIDOMNSEditableElement, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/content/html/content/src/HTMLLIElement.h b/content/html/content/src/HTMLLIElement.h index 9f9e557f964f..d26810d9b7f6 100644 --- a/content/html/content/src/HTMLLIElement.h +++ b/content/html/content/src/HTMLLIElement.h @@ -14,8 +14,8 @@ namespace mozilla { namespace dom { -class HTMLLIElement : public nsGenericHTMLElement, - public nsIDOMHTMLLIElement +class HTMLLIElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLLIElement { public: HTMLLIElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLLabelElement.h b/content/html/content/src/HTMLLabelElement.h index 9230fc202c09..00e6d65eea62 100644 --- a/content/html/content/src/HTMLLabelElement.h +++ b/content/html/content/src/HTMLLabelElement.h @@ -16,8 +16,8 @@ namespace mozilla { namespace dom { -class HTMLLabelElement : public nsGenericHTMLFormElement, - public nsIDOMHTMLLabelElement +class HTMLLabelElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsIDOMHTMLLabelElement { public: HTMLLabelElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLLegendElement.h b/content/html/content/src/HTMLLegendElement.h index b6556d5084cf..8e88f7bd5940 100644 --- a/content/html/content/src/HTMLLegendElement.h +++ b/content/html/content/src/HTMLLegendElement.h @@ -14,8 +14,8 @@ namespace mozilla { namespace dom { -class HTMLLegendElement : public nsGenericHTMLElement, - public nsIDOMHTMLLegendElement +class HTMLLegendElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLLegendElement { public: HTMLLegendElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLLinkElement.h b/content/html/content/src/HTMLLinkElement.h index 295a1962d900..c7dc846fbaf2 100644 --- a/content/html/content/src/HTMLLinkElement.h +++ b/content/html/content/src/HTMLLinkElement.h @@ -16,11 +16,11 @@ namespace mozilla { namespace dom { -class HTMLLinkElement : public nsGenericHTMLElement, - public nsIDOMHTMLLinkElement, - public nsILink, - public nsStyleLinkElement, - public Link +class HTMLLinkElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLLinkElement, + public nsILink, + public nsStyleLinkElement, + public Link { public: HTMLLinkElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLMapElement.h b/content/html/content/src/HTMLMapElement.h index 59baace5419e..5c2c18928731 100644 --- a/content/html/content/src/HTMLMapElement.h +++ b/content/html/content/src/HTMLMapElement.h @@ -17,8 +17,8 @@ class nsContentList; namespace mozilla { namespace dom { -class HTMLMapElement : public nsGenericHTMLElement, - public nsIDOMHTMLMapElement +class HTMLMapElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLMapElement { public: HTMLMapElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLMenuElement.h b/content/html/content/src/HTMLMenuElement.h index 83ec71c5ee66..8013a5e3c48f 100644 --- a/content/html/content/src/HTMLMenuElement.h +++ b/content/html/content/src/HTMLMenuElement.h @@ -14,9 +14,9 @@ namespace mozilla { namespace dom { -class HTMLMenuElement : public nsGenericHTMLElement, - public nsIDOMHTMLMenuElement, - public nsIHTMLMenu +class HTMLMenuElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLMenuElement, + public nsIHTMLMenu { public: HTMLMenuElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLMenuItemElement.h b/content/html/content/src/HTMLMenuItemElement.h index a2613f2e786d..42df846a2632 100644 --- a/content/html/content/src/HTMLMenuItemElement.h +++ b/content/html/content/src/HTMLMenuItemElement.h @@ -15,8 +15,8 @@ namespace dom { class Visitor; -class HTMLMenuItemElement : public nsGenericHTMLElement, - public nsIDOMHTMLMenuItemElement +class HTMLMenuItemElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLMenuItemElement { public: using mozilla::dom::Element::GetText; diff --git a/content/html/content/src/HTMLMetaElement.h b/content/html/content/src/HTMLMetaElement.h index 8b0cf2698b17..1411fe54bcc7 100644 --- a/content/html/content/src/HTMLMetaElement.h +++ b/content/html/content/src/HTMLMetaElement.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class HTMLMetaElement : public nsGenericHTMLElement, - public nsIDOMHTMLMetaElement +class HTMLMetaElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLMetaElement { public: HTMLMetaElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLMeterElement.h b/content/html/content/src/HTMLMeterElement.h index 0d596378d7a9..2110ad2411b7 100644 --- a/content/html/content/src/HTMLMeterElement.h +++ b/content/html/content/src/HTMLMeterElement.h @@ -18,8 +18,8 @@ namespace mozilla { namespace dom { -class HTMLMeterElement : public nsGenericHTMLElement, - public nsIDOMHTMLMeterElement +class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLMeterElement { public: HTMLMeterElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLModElement.h b/content/html/content/src/HTMLModElement.h index dfde9df9ad10..e17495e37037 100644 --- a/content/html/content/src/HTMLModElement.h +++ b/content/html/content/src/HTMLModElement.h @@ -14,8 +14,8 @@ namespace mozilla { namespace dom { -class HTMLModElement : public nsGenericHTMLElement, - public nsIDOMHTMLModElement +class HTMLModElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLModElement { public: HTMLModElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLOptGroupElement.h b/content/html/content/src/HTMLOptGroupElement.h index 6bcbba429472..c161f5e5af3a 100644 --- a/content/html/content/src/HTMLOptGroupElement.h +++ b/content/html/content/src/HTMLOptGroupElement.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class HTMLOptGroupElement : public nsGenericHTMLElement, - public nsIDOMHTMLOptGroupElement +class HTMLOptGroupElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLOptGroupElement { public: HTMLOptGroupElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLOptionElement.h b/content/html/content/src/HTMLOptionElement.h index a191778683a3..2631abb7e51b 100644 --- a/content/html/content/src/HTMLOptionElement.h +++ b/content/html/content/src/HTMLOptionElement.h @@ -18,8 +18,8 @@ namespace dom { class HTMLSelectElement; -class HTMLOptionElement : public nsGenericHTMLElement, - public nsIDOMHTMLOptionElement +class HTMLOptionElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLOptionElement { public: HTMLOptionElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLOutputElement.h b/content/html/content/src/HTMLOutputElement.h index 89067a33bdc1..283b4e308894 100644 --- a/content/html/content/src/HTMLOutputElement.h +++ b/content/html/content/src/HTMLOutputElement.h @@ -15,10 +15,10 @@ namespace mozilla { namespace dom { -class HTMLOutputElement : public nsGenericHTMLFormElement, - public nsIDOMHTMLOutputElement, - public nsStubMutationObserver, - public nsIConstraintValidation +class HTMLOutputElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsIDOMHTMLOutputElement, + public nsStubMutationObserver, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/content/html/content/src/HTMLParagraphElement.h b/content/html/content/src/HTMLParagraphElement.h index ec7971d5e9b0..f421c694899f 100644 --- a/content/html/content/src/HTMLParagraphElement.h +++ b/content/html/content/src/HTMLParagraphElement.h @@ -15,8 +15,8 @@ namespace mozilla { namespace dom { -class HTMLParagraphElement : public nsGenericHTMLElement, - public nsIDOMHTMLParagraphElement +class HTMLParagraphElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLParagraphElement { public: HTMLParagraphElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLPreElement.h b/content/html/content/src/HTMLPreElement.h index c026974fc78a..4eb2a0365230 100644 --- a/content/html/content/src/HTMLPreElement.h +++ b/content/html/content/src/HTMLPreElement.h @@ -15,8 +15,8 @@ namespace mozilla { namespace dom { -class HTMLPreElement : public nsGenericHTMLElement, - public nsIDOMHTMLPreElement +class HTMLPreElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLPreElement { public: HTMLPreElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLProgressElement.h b/content/html/content/src/HTMLProgressElement.h index 58bda9d57591..0be9491a8d8d 100644 --- a/content/html/content/src/HTMLProgressElement.h +++ b/content/html/content/src/HTMLProgressElement.h @@ -17,8 +17,8 @@ namespace mozilla { namespace dom { -class HTMLProgressElement : public nsGenericHTMLElement, - public nsIDOMHTMLProgressElement +class HTMLProgressElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLProgressElement { public: HTMLProgressElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLSelectElement.h b/content/html/content/src/HTMLSelectElement.h index c1e66f27b0e6..969d989f5977 100644 --- a/content/html/content/src/HTMLSelectElement.h +++ b/content/html/content/src/HTMLSelectElement.h @@ -103,9 +103,9 @@ class MOZ_STACK_CLASS SafeOptionListMutation /** * Implementation of <select> */ -class HTMLSelectElement : public nsGenericHTMLFormElement, - public nsIDOMHTMLSelectElement, - public nsIConstraintValidation +class HTMLSelectElement MOZ_FINAL : public nsGenericHTMLFormElement, + public nsIDOMHTMLSelectElement, + public nsIConstraintValidation { public: using nsIConstraintValidation::GetValidationMessage; diff --git a/content/html/content/src/HTMLSharedElement.h b/content/html/content/src/HTMLSharedElement.h index 4b91565a1167..c18dbc88cb27 100644 --- a/content/html/content/src/HTMLSharedElement.h +++ b/content/html/content/src/HTMLSharedElement.h @@ -22,13 +22,13 @@ namespace mozilla { namespace dom { -class HTMLSharedElement : public nsGenericHTMLElement, - public nsIDOMHTMLParamElement, - public nsIDOMHTMLBaseElement, - public nsIDOMHTMLDirectoryElement, - public nsIDOMHTMLQuoteElement, - public nsIDOMHTMLHeadElement, - public nsIDOMHTMLHtmlElement +class HTMLSharedElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLParamElement, + public nsIDOMHTMLBaseElement, + public nsIDOMHTMLDirectoryElement, + public nsIDOMHTMLQuoteElement, + public nsIDOMHTMLHeadElement, + public nsIDOMHTMLHtmlElement { public: HTMLSharedElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLSharedListElement.h b/content/html/content/src/HTMLSharedListElement.h index 4a618ac99b98..28b87dea013a 100644 --- a/content/html/content/src/HTMLSharedListElement.h +++ b/content/html/content/src/HTMLSharedListElement.h @@ -16,10 +16,10 @@ namespace mozilla { namespace dom { -class HTMLSharedListElement : public nsGenericHTMLElement, - public nsIDOMHTMLOListElement, - public nsIDOMHTMLDListElement, - public nsIDOMHTMLUListElement +class HTMLSharedListElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLOListElement, + public nsIDOMHTMLDListElement, + public nsIDOMHTMLUListElement { public: HTMLSharedListElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLSharedObjectElement.h b/content/html/content/src/HTMLSharedObjectElement.h index 2ee49799c9d1..07fc69b267e0 100644 --- a/content/html/content/src/HTMLSharedObjectElement.h +++ b/content/html/content/src/HTMLSharedObjectElement.h @@ -18,10 +18,10 @@ namespace mozilla { namespace dom { -class HTMLSharedObjectElement : public nsGenericHTMLElement - , public nsObjectLoadingContent - , public nsIDOMHTMLAppletElement - , public nsIDOMHTMLEmbedElement +class HTMLSharedObjectElement MOZ_FINAL : public nsGenericHTMLElement + , public nsObjectLoadingContent + , public nsIDOMHTMLAppletElement + , public nsIDOMHTMLEmbedElement { public: HTMLSharedObjectElement(already_AddRefed aNodeInfo, diff --git a/content/html/content/src/HTMLSourceElement.h b/content/html/content/src/HTMLSourceElement.h index 0514a0b26a0c..eb7e1ec6b176 100644 --- a/content/html/content/src/HTMLSourceElement.h +++ b/content/html/content/src/HTMLSourceElement.h @@ -15,8 +15,8 @@ namespace mozilla { namespace dom { -class HTMLSourceElement : public nsGenericHTMLElement, - public nsIDOMHTMLSourceElement +class HTMLSourceElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLSourceElement { public: HTMLSourceElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLSpanElement.h b/content/html/content/src/HTMLSpanElement.h index 29b0146bbeab..c72489413eeb 100644 --- a/content/html/content/src/HTMLSpanElement.h +++ b/content/html/content/src/HTMLSpanElement.h @@ -17,8 +17,8 @@ namespace mozilla { namespace dom { -class HTMLSpanElement : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLSpanElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLElement { public: HTMLSpanElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTableCaptionElement.h b/content/html/content/src/HTMLTableCaptionElement.h index 12f3d2d2236f..d2d8e5ef2123 100644 --- a/content/html/content/src/HTMLTableCaptionElement.h +++ b/content/html/content/src/HTMLTableCaptionElement.h @@ -12,8 +12,8 @@ namespace mozilla { namespace dom { -class HTMLTableCaptionElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableCaptionElement +class HTMLTableCaptionElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableCaptionElement { public: HTMLTableCaptionElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTableCellElement.h b/content/html/content/src/HTMLTableCellElement.h index 3b7d00f346d5..c1503911edbb 100644 --- a/content/html/content/src/HTMLTableCellElement.h +++ b/content/html/content/src/HTMLTableCellElement.h @@ -16,8 +16,8 @@ namespace dom { class HTMLTableElement; -class HTMLTableCellElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableCellElement +class HTMLTableCellElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableCellElement { public: HTMLTableCellElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTableColElement.h b/content/html/content/src/HTMLTableColElement.h index 41f2dbfcbc4d..401050610198 100644 --- a/content/html/content/src/HTMLTableColElement.h +++ b/content/html/content/src/HTMLTableColElement.h @@ -12,8 +12,8 @@ namespace mozilla { namespace dom { -class HTMLTableColElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableColElement +class HTMLTableColElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableColElement { public: HTMLTableColElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTableElement.h b/content/html/content/src/HTMLTableElement.h index 0ec90d127de4..0f158fe3c064 100644 --- a/content/html/content/src/HTMLTableElement.h +++ b/content/html/content/src/HTMLTableElement.h @@ -18,8 +18,8 @@ namespace dom { class TableRowsCollection; -class HTMLTableElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableElement +class HTMLTableElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableElement { public: HTMLTableElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLTableRowElement.h b/content/html/content/src/HTMLTableRowElement.h index 19155c96b752..edbb0149fd71 100644 --- a/content/html/content/src/HTMLTableRowElement.h +++ b/content/html/content/src/HTMLTableRowElement.h @@ -16,8 +16,8 @@ class nsContentList; namespace mozilla { namespace dom { -class HTMLTableRowElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableRowElement +class HTMLTableRowElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableRowElement { public: HTMLTableRowElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTableSectionElement.h b/content/html/content/src/HTMLTableSectionElement.h index 1234a0205b38..015730407f0d 100644 --- a/content/html/content/src/HTMLTableSectionElement.h +++ b/content/html/content/src/HTMLTableSectionElement.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class HTMLTableSectionElement : public nsGenericHTMLElement, - public nsIDOMHTMLTableSectionElement +class HTMLTableSectionElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTableSectionElement { public: HTMLTableSectionElement(already_AddRefed aNodeInfo) diff --git a/content/html/content/src/HTMLTemplateElement.h b/content/html/content/src/HTMLTemplateElement.h index 307e7659af1b..eb2ceabac634 100644 --- a/content/html/content/src/HTMLTemplateElement.h +++ b/content/html/content/src/HTMLTemplateElement.h @@ -14,8 +14,8 @@ namespace mozilla { namespace dom { -class HTMLTemplateElement : public nsGenericHTMLElement, - public nsIDOMHTMLElement +class HTMLTemplateElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLElement { public: HTMLTemplateElement(already_AddRefed aNodeInfo); diff --git a/content/html/content/src/HTMLTitleElement.h b/content/html/content/src/HTMLTitleElement.h index 7c6d9838e0ab..a23c68b3e754 100644 --- a/content/html/content/src/HTMLTitleElement.h +++ b/content/html/content/src/HTMLTitleElement.h @@ -16,9 +16,9 @@ class ErrorResult; namespace dom { -class HTMLTitleElement : public nsGenericHTMLElement, - public nsIDOMHTMLTitleElement, - public nsStubMutationObserver +class HTMLTitleElement MOZ_FINAL : public nsGenericHTMLElement, + public nsIDOMHTMLTitleElement, + public nsStubMutationObserver { public: using Element::GetText; diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 91d7f9439889..2e22d6f51dd8 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -15,9 +15,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/content/html/document/src/ImageDocument.h b/content/html/document/src/ImageDocument.h index 0696f8483c37..d431b29a4ff9 100644 --- a/content/html/document/src/ImageDocument.h +++ b/content/html/document/src/ImageDocument.h @@ -14,10 +14,10 @@ namespace mozilla { namespace dom { -class ImageDocument : public MediaDocument, - public nsIImageDocument, - public imgINotificationObserver, - public nsIDOMEventListener +class ImageDocument MOZ_FINAL : public MediaDocument, + public nsIImageDocument, + public imgINotificationObserver, + public nsIDOMEventListener { public: ImageDocument(); diff --git a/content/html/document/src/Makefile.in b/content/html/document/src/Makefile.in index cec6a751a268..0c0768dee666 100644 --- a/content/html/document/src/Makefile.in +++ b/content/html/document/src/Makefile.in @@ -14,9 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ diff --git a/content/html/document/src/PluginDocument.cpp b/content/html/document/src/PluginDocument.cpp index 1940f5a2c37f..3e06c4e442fd 100644 --- a/content/html/document/src/PluginDocument.cpp +++ b/content/html/document/src/PluginDocument.cpp @@ -22,8 +22,8 @@ namespace mozilla { namespace dom { -class PluginDocument : public MediaDocument - , public nsIPluginDocument +class PluginDocument MOZ_FINAL : public MediaDocument + , public nsIPluginDocument { public: PluginDocument(); diff --git a/content/html/document/src/VideoDocument.cpp b/content/html/document/src/VideoDocument.cpp index 4817c79582a5..fd92e84ba8e9 100644 --- a/content/html/document/src/VideoDocument.cpp +++ b/content/html/document/src/VideoDocument.cpp @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { -class VideoDocument : public MediaDocument +class VideoDocument MOZ_FINAL : public MediaDocument { public: virtual nsresult StartDocumentLoad(const char* aCommand, diff --git a/content/mathml/content/src/Makefile.in b/content/mathml/content/src/Makefile.in index ae9b5f5e31c0..4af2e3e4b809 100644 --- a/content/mathml/content/src/Makefile.in +++ b/content/mathml/content/src/Makefile.in @@ -17,10 +17,6 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk -# we don't want the shared lib, but we want to force the creation of a static -# lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/mathml/content/src/nsMathMLElement.h b/content/mathml/content/src/nsMathMLElement.h index 2caf62203b2d..6285ecd49c10 100644 --- a/content/mathml/content/src/nsMathMLElement.h +++ b/content/mathml/content/src/nsMathMLElement.h @@ -19,10 +19,10 @@ typedef nsMappedAttributeElement nsMathMLElementBase; /* * The base class for MathML elements. */ -class nsMathMLElement : public nsMathMLElementBase, - public nsIDOMElement, - public nsILink, - public mozilla::dom::Link +class nsMathMLElement MOZ_FINAL : public nsMathMLElementBase, + public nsIDOMElement, + public nsILink, + public mozilla::dom::Link { public: nsMathMLElement(already_AddRefed aNodeInfo); diff --git a/content/media/Makefile.in b/content/media/Makefile.in index 07b81d4fabd8..25f47121d516 100644 --- a/content/media/Makefile.in +++ b/content/media/Makefile.in @@ -14,8 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/content/media/dash/Makefile.in b/content/media/dash/Makefile.in index a62647dde079..40bccbe10b2e 100644 --- a/content/media/dash/Makefile.in +++ b/content/media/dash/Makefile.in @@ -17,8 +17,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY := 1 -FORCE_STATIC_LIB := 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES := \ diff --git a/content/media/encoder/Makefile.in b/content/media/encoder/Makefile.in index 698bdde67813..c4e33711a8ee 100644 --- a/content/media/encoder/Makefile.in +++ b/content/media/encoder/Makefile.in @@ -13,6 +13,4 @@ LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in index db8f4ca30e5e..86cc606de10d 100644 --- a/content/media/gstreamer/Makefile.in +++ b/content/media/gstreamer/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk CFLAGS += $(GSTREAMER_CFLAGS) diff --git a/content/media/ogg/Makefile.in b/content/media/ogg/Makefile.in index 8f3e75fb1fdf..86df1d7589af 100644 --- a/content/media/ogg/Makefile.in +++ b/content/media/ogg/Makefile.in @@ -13,6 +13,4 @@ LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/content/media/ogg/OggReader.cpp b/content/media/ogg/OggReader.cpp index 4874f2c0617a..8b0cae4af292 100644 --- a/content/media/ogg/OggReader.cpp +++ b/content/media/ogg/OggReader.cpp @@ -298,7 +298,7 @@ nsresult OggReader::ReadMetadata(VideoInfo* aInfo, if (mVorbisState && ReadHeaders(mVorbisState)) { mInfo.mHasAudio = true; mInfo.mAudioRate = mVorbisState->mInfo.rate; - mInfo.mAudioChannels = mVorbisState->mInfo.channels; + mInfo.mAudioChannels = mVorbisState->mInfo.channels > 2 ? 2 : mVorbisState->mInfo.channels; // Copy Vorbis info data for time computations on other threads. memcpy(&mVorbisInfo, &mVorbisState->mInfo, sizeof(mVorbisInfo)); mVorbisInfo.codec_setup = NULL; @@ -404,6 +404,15 @@ nsresult OggReader::DecodeVorbis(ogg_packet* aPacket) { } } + // More than 2 decoded channels must be downmixed to stereo. + if (channels > 2) { + if (channels > 8) { + // No channel mapping for more than 8 channels. + return NS_ERROR_FAILURE; + } + DownmixToStereo(buffer, channels, frames); + } + int64_t duration = mVorbisState->Time((int64_t)frames); int64_t startTime = mVorbisState->Time(endFrame - frames); mAudioQueue.Push(new AudioData(mPageOffset, @@ -520,57 +529,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { // so we can't downmix more than that. if (channels > 8) return NS_ERROR_FAILURE; - - uint32_t out_channels; - out_channels = 2; - // dBuffer stores the downmixed sample data. - nsAutoArrayPtr dBuffer(new AudioDataValue[frames * out_channels]); -#ifdef MOZ_SAMPLE_TYPE_FLOAT32 - // Downmix matrix. Per-row normalization 1 for rows 3,4 and 2 for rows 5-8. - static const float dmatrix[6][8][2]= { - /*3*/{ {0.5858f,0}, {0.4142f,0.4142f}, {0,0.5858f}}, - /*4*/{ {0.4226f,0}, {0,0.4226f}, {0.366f,0.2114f}, {0.2114f,0.366f}}, - /*5*/{ {0.651f,0}, {0.46f,0.46f}, {0,0.651f}, {0.5636f,0.3254f}, {0.3254f,0.5636f}}, - /*6*/{ {0.529f,0}, {0.3741f,0.3741f}, {0,0.529f}, {0.4582f,0.2645f}, {0.2645f,0.4582f}, {0.3741f,0.3741f}}, - /*7*/{ {0.4553f,0}, {0.322f,0.322f}, {0,0.4553f}, {0.3943f,0.2277f}, {0.2277f,0.3943f}, {0.2788f,0.2788f}, {0.322f,0.322f}}, - /*8*/{ {0.3886f,0}, {0.2748f,0.2748f}, {0,0.3886f}, {0.3366f,0.1943f}, {0.1943f,0.3366f}, {0.3366f,0.1943f}, {0.1943f,0.3366f}, {0.2748f,0.2748f}}, - }; - for (int32_t i = 0; i < frames; i++) { - float sampL = 0.0; - float sampR = 0.0; - for (uint32_t j = 0; j < channels; j++) { - sampL+=buffer[i*channels+j]*dmatrix[channels-3][j][0]; - sampR+=buffer[i*channels+j]*dmatrix[channels-3][j][1]; - } - dBuffer[i*out_channels]=sampL; - dBuffer[i*out_channels+1]=sampR; - } -#else - // Downmix matrix. Per-row normalization 1 for rows 3,4 and 2 for rows 5-8. - // Coefficients in Q14. - static const int16_t dmatrix[6][8][2]= { - /*3*/{{9598, 0},{6786,6786},{0, 9598}}, - /*4*/{{6925, 0},{0, 6925},{5997,3462},{3462,5997}}, - /*5*/{{10663,0},{7540,7540},{0, 10663},{9234,5331},{5331,9234}}, - /*6*/{{8668, 0},{6129,6129},{0, 8668},{7507,4335},{4335,7507},{6129,6129}}, - /*7*/{{7459, 0},{5275,5275},{0, 7459},{6460,3731},{3731,6460},{4568,4568},{5275,5275}}, - /*8*/{{6368, 0},{4502,4502},{0, 6368},{5514,3184},{3184,5514},{5514,3184},{3184,5514},{4502,4502}} - }; - for (int32_t i = 0; i < frames; i++) { - int32_t sampL = 0; - int32_t sampR = 0; - for (uint32_t j = 0; j < channels; j++) { - sampL+=buffer[i*channels+j]*dmatrix[channels-3][j][0]; - sampR+=buffer[i*channels+j]*dmatrix[channels-3][j][1]; - } - sampL = (sampL + 8192)>>14; - dBuffer[i*out_channels] = static_cast(MOZ_CLIP_TO_15(sampL)); - sampR = (sampR + 8192)>>14; - dBuffer[i*out_channels+1] = static_cast(MOZ_CLIP_TO_15(sampR)); - } -#endif - channels = out_channels; - buffer = dBuffer; + DownmixToStereo(buffer, channels, frames); } LOG(PR_LOG_DEBUG, ("Opus decoder pushing %d frames", frames)); @@ -589,6 +548,61 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { } #endif /* MOZ_OPUS */ +void OggReader::DownmixToStereo(nsAutoArrayPtr& buffer, + uint32_t& channels, int32_t frames) +{ + uint32_t out_channels; + out_channels = 2; + // dBuffer stores the downmixed samples. + nsAutoArrayPtr dBuffer(new AudioDataValue[frames * out_channels]); +#ifdef MOZ_SAMPLE_TYPE_FLOAT32 + // Downmix matrix. Per-row normalization 1 for rows 3,4 and 2 for rows 5-8. + static const float dmatrix[6][8][2]= { + /*3*/{{0.5858f,0},{0.4142f,0.4142f},{0, 0.5858f}}, + /*4*/{{0.4226f,0},{0, 0.4226f},{0.366f,0.2114f},{0.2114f,0.366f}}, + /*5*/{{0.6510f,0},{0.4600f,0.4600f},{0, 0.6510f},{0.5636f,0.3254f},{0.3254f,0.5636f}}, + /*6*/{{0.5290f,0},{0.3741f,0.3741f},{0, 0.5290f},{0.4582f,0.2645f},{0.2645f,0.4582f},{0.3741f,0.3741f}}, + /*7*/{{0.4553f,0},{0.3220f,0.3220f},{0, 0.4553f},{0.3943f,0.2277f},{0.2277f,0.3943f},{0.2788f,0.2788f},{0.3220f,0.3220f}}, + /*8*/{{0.3886f,0},{0.2748f,0.2748f},{0, 0.3886f},{0.3366f,0.1943f},{0.1943f,0.3366f},{0.3366f,0.1943f},{0.1943f,0.3366f},{0.2748f,0.2748f}}, + }; + for (int32_t i = 0; i < frames; i++) { + float sampL = 0.0; + float sampR = 0.0; + for (uint32_t j = 0; j < channels; j++) { + sampL+=buffer[i*channels+j]*dmatrix[channels-3][j][0]; + sampR+=buffer[i*channels+j]*dmatrix[channels-3][j][1]; + } + dBuffer[i*out_channels]=sampL; + dBuffer[i*out_channels+1]=sampR; + } +#else + // Downmix matrix. Per-row normalization 1 for rows 3,4 and 2 for rows 5-8. + // Coefficients in Q14. + static const int16_t dmatrix[6][8][2]= { + /*3*/{{9598, 0},{6786,6786},{0, 9598}}, + /*4*/{{6925, 0},{0, 6925},{5997,3462},{3462,5997}}, + /*5*/{{10663,0},{7540,7540},{0, 10663},{9234,5331},{5331,9234}}, + /*6*/{{8668, 0},{6129,6129},{0, 8668},{7507,4335},{4335,7507},{6129,6129}}, + /*7*/{{7459, 0},{5275,5275},{0, 7459},{6460,3731},{3731,6460},{4568,4568},{5275,5275}}, + /*8*/{{6368, 0},{4502,4502},{0, 6368},{5514,3184},{3184,5514},{5514,3184},{3184,5514},{4502,4502}} + }; + for (int32_t i = 0; i < frames; i++) { + int32_t sampL = 0; + int32_t sampR = 0; + for (uint32_t j = 0; j < channels; j++) { + sampL+=buffer[i*channels+j]*dmatrix[channels-3][j][0]; + sampR+=buffer[i*channels+j]*dmatrix[channels-3][j][1]; + } + sampL = (sampL + 8192)>>14; + dBuffer[i*out_channels] = static_cast(MOZ_CLIP_TO_15(sampL)); + sampR = (sampR + 8192)>>14; + dBuffer[i*out_channels+1] = static_cast(MOZ_CLIP_TO_15(sampR)); + } +#endif + channels = out_channels; + buffer = dBuffer; +} + bool OggReader::DecodeAudioData() { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/ogg/OggReader.h b/content/media/ogg/OggReader.h index 76171c824189..c7c953ff8f0b 100644 --- a/content/media/ogg/OggReader.h +++ b/content/media/ogg/OggReader.h @@ -220,6 +220,13 @@ class OggReader : public MediaDecoderReader // audio queue. nsresult DecodeOpus(ogg_packet* aPacket); + // Downmix multichannel Audio samples to Stereo. + // It is used from Vorbis and Opus decoders. + // Input are the buffer contains multichannel data, + // the number of channels and the number of frames. + void DownmixToStereo(nsAutoArrayPtr& buffer, + uint32_t& channel, int32_t frames); + // Decodes a packet of Theora data, and inserts its frame into the // video queue. May return NS_ERROR_OUT_OF_MEMORY. Caller must have obtained // the reader's monitor. aTimeThreshold is the current playback position diff --git a/content/media/omx/Makefile.in b/content/media/omx/Makefile.in index 9717543d3445..791e89f17f63 100644 --- a/content/media/omx/Makefile.in +++ b/content/media/omx/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconomx_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/content/media/plugins/Makefile.in b/content/media/plugins/Makefile.in index 67c77c2988b9..105ec7f29a5d 100644 --- a/content/media/plugins/Makefile.in +++ b/content/media/plugins/Makefile.in @@ -11,8 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/media/raw/Makefile.in b/content/media/raw/Makefile.in index 8a2b174074f2..57d9b3875560 100644 --- a/content/media/raw/Makefile.in +++ b/content/media/raw/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/media/test/test_framebuffer.html b/content/media/test/test_framebuffer.html index 915aada2d8fb..b6df9546c861 100644 --- a/content/media/test/test_framebuffer.html +++ b/content/media/test/test_framebuffer.html @@ -19,9 +19,9 @@ + + + + diff --git a/content/svg/content/src/crashtests/880544-2.svg b/content/svg/content/src/crashtests/880544-2.svg new file mode 100644 index 000000000000..7570c7cbfeb0 --- /dev/null +++ b/content/svg/content/src/crashtests/880544-2.svg @@ -0,0 +1,15 @@ + + + + foo + + diff --git a/content/svg/content/src/crashtests/880544-3.svg b/content/svg/content/src/crashtests/880544-3.svg new file mode 100644 index 000000000000..5791b8ec6255 --- /dev/null +++ b/content/svg/content/src/crashtests/880544-3.svg @@ -0,0 +1,15 @@ + + + + foo + + diff --git a/content/svg/content/src/crashtests/880544-4.svg b/content/svg/content/src/crashtests/880544-4.svg new file mode 100644 index 000000000000..7bdb80f478a1 --- /dev/null +++ b/content/svg/content/src/crashtests/880544-4.svg @@ -0,0 +1,15 @@ + + + + + + diff --git a/content/svg/content/src/crashtests/880544-5.svg b/content/svg/content/src/crashtests/880544-5.svg new file mode 100644 index 000000000000..ef7f468f8a28 --- /dev/null +++ b/content/svg/content/src/crashtests/880544-5.svg @@ -0,0 +1,15 @@ + + + + + + diff --git a/content/svg/content/src/crashtests/crashtests.list b/content/svg/content/src/crashtests/crashtests.list index 18aee3a2a155..bbf1918e556d 100644 --- a/content/svg/content/src/crashtests/crashtests.list +++ b/content/svg/content/src/crashtests/crashtests.list @@ -66,3 +66,8 @@ load 831561.html load 837450-1.svg load 842463-1.html load 864509.svg +load 880544-1.svg +load 880544-2.svg +load 880544-3.svg +load 880544-4.svg +load 880544-5.svg diff --git a/content/svg/content/src/nsSVGAngle.cpp b/content/svg/content/src/nsSVGAngle.cpp index 29b5b5b4ac7e..621011fab864 100644 --- a/content/svg/content/src/nsSVGAngle.cpp +++ b/content/svg/content/src/nsSVGAngle.cpp @@ -379,6 +379,8 @@ nsSVGAngle::SMILOrient::ValueFromString(const nsAString& aStr, nsSMILValue val(&SVGOrientSMILType::sSingleton); if (aStr.EqualsLiteral("auto")) { val.mU.mOrient.mOrientType = SVG_MARKER_ORIENT_AUTO; + } else if (aStr.EqualsLiteral("auto-start-reverse")) { + val.mU.mOrient.mOrientType = SVG_MARKER_ORIENT_AUTO_START_REVERSE; } else { float value; uint16_t unitType; @@ -426,7 +428,8 @@ nsSVGAngle::SMILOrient::SetAnimValue(const nsSMILValue& aValue) if (aValue.mType == &SVGOrientSMILType::sSingleton) { mOrientType->SetAnimValue(aValue.mU.mOrient.mOrientType); - if (aValue.mU.mOrient.mOrientType == SVG_MARKER_ORIENT_AUTO) { + if (aValue.mU.mOrient.mOrientType == SVG_MARKER_ORIENT_AUTO || + aValue.mU.mOrient.mOrientType == SVG_MARKER_ORIENT_AUTO_START_REVERSE) { mAngle->SetAnimValue(0.0f, SVG_ANGLETYPE_UNSPECIFIED, mSVGElement); } else { mAngle->SetAnimValue(aValue.mU.mOrient.mAngle, aValue.mU.mOrient.mUnit, mSVGElement); diff --git a/content/svg/content/src/nsSVGPathGeometryElement.h b/content/svg/content/src/nsSVGPathGeometryElement.h index 88dd19100f7e..2773e6ebb757 100644 --- a/content/svg/content/src/nsSVGPathGeometryElement.h +++ b/content/svg/content/src/nsSVGPathGeometryElement.h @@ -12,9 +12,18 @@ struct gfxMatrix; template class nsTArray; struct nsSVGMark { + enum Type { + eStart, + eMid, + eEnd, + + eTypeCount + }; + float x, y, angle; - nsSVGMark(float aX, float aY, float aAngle) : - x(aX), y(aY), angle(aAngle) {} + Type type; + nsSVGMark(float aX, float aY, float aAngle, Type aType) : + x(aX), y(aY), angle(aAngle), type(aType) {} }; class gfxContext; diff --git a/content/svg/content/src/nsSVGPolyElement.cpp b/content/svg/content/src/nsSVGPolyElement.cpp index 7692ebec69c9..fa43533d8b03 100644 --- a/content/svg/content/src/nsSVGPolyElement.cpp +++ b/content/svg/content/src/nsSVGPolyElement.cpp @@ -78,26 +78,32 @@ nsSVGPolyElement::GetMarkPoints(nsTArray *aMarks) if (!points.Length()) return; - float px = 0.0, py = 0.0, prevAngle = 0.0; + float px = points[0].mX, py = points[0].mY, prevAngle = 0.0; - for (uint32_t i = 0; i < points.Length(); ++i) { + aMarks->AppendElement(nsSVGMark(px, py, 0, nsSVGMark::eStart)); + + for (uint32_t i = 1; i < points.Length(); ++i) { float x = points[i].mX; float y = points[i].mY; float angle = atan2(y-py, x-px); - if (i == 1) - aMarks->ElementAt(aMarks->Length() - 1).angle = angle; - else if (i > 1) - aMarks->ElementAt(aMarks->Length() - 1).angle = + + // Vertex marker. + if (i == 1) { + aMarks->ElementAt(0).angle = angle; + } else { + aMarks->ElementAt(aMarks->Length() - 2).angle = SVGContentUtils::AngleBisect(prevAngle, angle); + } - aMarks->AppendElement(nsSVGMark(x, y, 0)); + aMarks->AppendElement(nsSVGMark(x, y, 0, nsSVGMark::eMid)); prevAngle = angle; px = x; py = y; } - aMarks->ElementAt(aMarks->Length() - 1).angle = prevAngle; + aMarks->LastElement().angle = prevAngle; + aMarks->LastElement().type = nsSVGMark::eEnd; } void diff --git a/content/svg/content/test/test_dataTypes.html b/content/svg/content/test/test_dataTypes.html index 73a69866ccf9..b40b7e45bf2c 100644 --- a/content/svg/content/test/test_dataTypes.html +++ b/content/svg/content/test/test_dataTypes.html @@ -169,6 +169,13 @@ marker.setAttribute("orient", "auto"); is(marker.getAttribute("orient"), "auto", "checking 'auto' string preserved"); + is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO, "type baseVal"); + is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO, "type animVal"); + + marker.setAttribute("orient", "auto-start-reverse"); + is(marker.getAttribute("orient"), "auto-start-reverse", "checking 'auto-start-reverse' string preserved"); + is(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN, "type baseVal"); + is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN, "type animVal"); marker.setAttribute("orient", ""); ok(marker.getAttribute("orient") === "", "empty angle attribute"); @@ -296,7 +303,11 @@ SimpleTest.finish(); } -window.addEventListener("load", runTests, false); +function runTestsWithPref() { + SpecialPowers.pushPrefEnv({ 'set': [['svg.marker-improvements.enabled', true]] }, runTests); +} + +window.addEventListener("load", runTestsWithPref, false); diff --git a/content/svg/document/src/Makefile.in b/content/svg/document/src/Makefile.in index e6e3af8a80fd..3394da3e5a8c 100644 --- a/content/svg/document/src/Makefile.in +++ b/content/svg/document/src/Makefile.in @@ -13,9 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/svg/document/src/SVGDocument.h b/content/svg/document/src/SVGDocument.h index 72c8652be048..798da7fa9afc 100644 --- a/content/svg/document/src/SVGDocument.h +++ b/content/svg/document/src/SVGDocument.h @@ -14,7 +14,7 @@ class nsSVGElement; namespace mozilla { namespace dom { -class SVGDocument : public XMLDocument +class SVGDocument MOZ_FINAL : public XMLDocument { public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; diff --git a/content/xbl/src/Makefile.in b/content/xbl/src/Makefile.in index 590e8a05537a..a636edfd6101 100644 --- a/content/xbl/src/Makefile.in +++ b/content/xbl/src/Makefile.in @@ -17,9 +17,6 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/config.mk -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/content/xml/content/src/CDATASection.h b/content/xml/content/src/CDATASection.h index 7f5b22c02efb..6caabd0591ee 100644 --- a/content/xml/content/src/CDATASection.h +++ b/content/xml/content/src/CDATASection.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { -class CDATASection : public Text, - public nsIDOMCDATASection +class CDATASection MOZ_FINAL : public Text, + public nsIDOMCDATASection { private: void Init() diff --git a/content/xml/content/src/Makefile.in b/content/xml/content/src/Makefile.in index 3d666d408e22..644faeb48096 100644 --- a/content/xml/content/src/Makefile.in +++ b/content/xml/content/src/Makefile.in @@ -14,9 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/xml/content/src/XMLStylesheetProcessingInstruction.h b/content/xml/content/src/XMLStylesheetProcessingInstruction.h index 42c675c7b9ba..e65f9227162d 100644 --- a/content/xml/content/src/XMLStylesheetProcessingInstruction.h +++ b/content/xml/content/src/XMLStylesheetProcessingInstruction.h @@ -13,8 +13,9 @@ namespace mozilla { namespace dom { -class XMLStylesheetProcessingInstruction : public ProcessingInstruction, - public nsStyleLinkElement +class XMLStylesheetProcessingInstruction MOZ_FINAL +: public ProcessingInstruction +, public nsStyleLinkElement { public: XMLStylesheetProcessingInstruction(already_AddRefed aNodeInfo, diff --git a/content/xml/document/src/Makefile.in b/content/xml/document/src/Makefile.in index e3df3b4b4eac..b3bbdd2bc085 100644 --- a/content/xml/document/src/Makefile.in +++ b/content/xml/document/src/Makefile.in @@ -14,9 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/content/xslt/src/base/Makefile.in b/content/xslt/src/base/Makefile.in index 4dd5624f7cb5..70ca9d5dd330 100644 --- a/content/xslt/src/base/Makefile.in +++ b/content/xslt/src/base/Makefile.in @@ -12,10 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/xslt/src/xml/Makefile.in b/content/xslt/src/xml/Makefile.in index c47593c7b6ed..590169fc38c2 100644 --- a/content/xslt/src/xml/Makefile.in +++ b/content/xslt/src/xml/Makefile.in @@ -12,10 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/xslt/src/xpath/Makefile.in b/content/xslt/src/xpath/Makefile.in index 5bce765a2d38..9c3cd97af495 100644 --- a/content/xslt/src/xpath/Makefile.in +++ b/content/xslt/src/xpath/Makefile.in @@ -12,10 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/content/xslt/src/xslt/Makefile.in b/content/xslt/src/xslt/Makefile.in index 531a1fc8a01e..1f2221c8ed4e 100644 --- a/content/xslt/src/xslt/Makefile.in +++ b/content/xslt/src/xslt/Makefile.in @@ -17,10 +17,6 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/dom/base \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - EXTRA_COMPONENTS = \ txEXSLTRegExFunctions.js \ txEXSLTRegExFunctions.manifest \ diff --git a/content/xul/content/src/Makefile.in b/content/xul/content/src/Makefile.in index de815cef87e2..d2ddab7f9f9f 100644 --- a/content/xul/content/src/Makefile.in +++ b/content/xul/content/src/Makefile.in @@ -16,10 +16,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 endif -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 8898b29322f0..789e603cc01e 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -350,8 +350,8 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 3); class nsScriptEventHandlerOwnerTearoff; -class nsXULElement : public nsStyledElement, - public nsIDOMXULElement +class nsXULElement MOZ_FINAL : public nsStyledElement, + public nsIDOMXULElement { public: nsXULElement(already_AddRefed aNodeInfo); diff --git a/content/xul/document/src/Makefile.in b/content/xul/document/src/Makefile.in index 761994957d0e..227abf5788e1 100644 --- a/content/xul/document/src/Makefile.in +++ b/content/xul/document/src/Makefile.in @@ -13,10 +13,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \ diff --git a/content/xul/document/src/XULDocument.h b/content/xul/document/src/XULDocument.h index f3648a08c8c7..e9c066757428 100644 --- a/content/xul/document/src/XULDocument.h +++ b/content/xul/document/src/XULDocument.h @@ -84,11 +84,11 @@ class nsRefMapEntry : public nsStringHashKey namespace mozilla { namespace dom { -class XULDocument : public XMLDocument, - public nsIXULDocument, - public nsIDOMXULDocument, - public nsIStreamLoaderObserver, - public nsICSSLoaderObserver +class XULDocument MOZ_FINAL : public XMLDocument, + public nsIXULDocument, + public nsIDOMXULDocument, + public nsIStreamLoaderObserver, + public nsICSSLoaderObserver { public: XULDocument(); diff --git a/content/xul/templates/src/Makefile.in b/content/xul/templates/src/Makefile.in index 0aa700892816..6cd559f6200e 100644 --- a/content/xul/templates/src/Makefile.in +++ b/content/xul/templates/src/Makefile.in @@ -13,9 +13,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \ diff --git a/docshell/base/Makefile.in b/docshell/base/Makefile.in index a957271c20bb..62897d9c94ea 100644 --- a/docshell/base/Makefile.in +++ b/docshell/base/Makefile.in @@ -19,10 +19,6 @@ ifdef MOZ_TOOLKIT_SEARCH DEFINES += -DMOZ_TOOLKIT_SEARCH endif -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/docshell/shistory/src/Makefile.in b/docshell/shistory/src/Makefile.in index 2d2064519019..7fecb85a394d 100644 --- a/docshell/shistory/src/Makefile.in +++ b/docshell/shistory/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/dom/activities/src/Makefile.in b/dom/activities/src/Makefile.in index 01407683640b..c648cc0abdd8 100644 --- a/dom/activities/src/Makefile.in +++ b/dom/activities/src/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_activities_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/alarm/Makefile.in b/dom/alarm/Makefile.in index 021ab1f1cf01..8f11898d37b1 100644 --- a/dom/alarm/Makefile.in +++ b/dom/alarm/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domalarm_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/audiochannel/Makefile.in b/dom/audiochannel/Makefile.in index 6c0f3452d23a..b60fbd5e9af9 100644 --- a/dom/audiochannel/Makefile.in +++ b/dom/audiochannel/Makefile.in @@ -21,7 +21,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domaudiochannel_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/base/DOMRequestHelper.jsm b/dom/base/DOMRequestHelper.jsm index b1101af80343..69ad623c5df8 100644 --- a/dom/base/DOMRequestHelper.jsm +++ b/dom/base/DOMRequestHelper.jsm @@ -82,6 +82,12 @@ DOMRequestIpcHelperMessageListener.prototype = { }, destroy: function() { + // DOMRequestIpcHelper.destroy() calls back into this function. + if (this._destroyed) { + return; + } + this._destroyed = true; + Services.obs.removeObserver(this, "inner-window-destroyed"); this._messages.forEach(function(msgName) { diff --git a/dom/base/Makefile.in b/dom/base/Makefile.in index 45b010324d00..398cc8671eb6 100644 --- a/dom/base/Makefile.in +++ b/dom/base/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdombase_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/battery/Makefile.in b/dom/battery/Makefile.in index b93ed50009c9..5eb26d85fc4e 100644 --- a/dom/battery/Makefile.in +++ b/dom/battery/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_battery_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index f9a251cf3bdd..8d32901a653f 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1350,7 +1350,7 @@ GetXrayExpandoChain(JSObject* obj) JS::Value v; if (IsDOMClass(clasp) || IsDOMIfaceAndProtoClass(clasp)) { v = js::GetReservedSlot(obj, DOM_XRAY_EXPANDO_SLOT); - } else if (js::IsObjectProxyClass(clasp) || js::IsFunctionProxyClass(clasp)) { + } else if (js::IsProxyClass(clasp)) { MOZ_ASSERT(js::GetProxyHandler(obj)->family() == ProxyFamily()); v = js::GetProxyExtra(obj, JSPROXYSLOT_XRAY_EXPANDO); } else { @@ -1367,7 +1367,7 @@ SetXrayExpandoChain(JSObject* obj, JSObject* chain) js::Class* clasp = js::GetObjectClass(obj); if (IsDOMClass(clasp) || IsDOMIfaceAndProtoClass(clasp)) { js::SetReservedSlot(obj, DOM_XRAY_EXPANDO_SLOT, v); - } else if (js::IsObjectProxyClass(clasp) || js::IsFunctionProxyClass(clasp)) { + } else if (js::IsProxyClass(clasp)) { MOZ_ASSERT(js::GetProxyHandler(obj)->family() == ProxyFamily()); js::SetProxyExtra(obj, JSPROXYSLOT_XRAY_EXPANDO, v); } else { diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 33b06c59abec..e0a21134072c 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -128,8 +128,8 @@ IsDOMIfaceAndProtoClass(const js::Class* clasp) return IsDOMIfaceAndProtoClass(Jsvalify(clasp)); } -MOZ_STATIC_ASSERT(DOM_OBJECT_SLOT == js::JSSLOT_PROXY_PRIVATE, - "JSSLOT_PROXY_PRIVATE doesn't match DOM_OBJECT_SLOT. " +MOZ_STATIC_ASSERT(DOM_OBJECT_SLOT == js::PROXY_PRIVATE_SLOT, + "js::PROXY_PRIVATE_SLOT doesn't match DOM_OBJECT_SLOT. " "Expect bad things"); template inline T* @@ -150,7 +150,7 @@ GetDOMClass(JSObject* obj) return &DOMJSClass::FromJSClass(clasp)->mClass; } - if (js::IsObjectProxyClass(clasp) || js::IsFunctionProxyClass(clasp)) { + if (js::IsProxyClass(clasp)) { js::BaseProxyHandler* handler = js::GetProxyHandler(obj); if (handler->family() == ProxyFamily()) { return &static_cast(handler)->mClass; diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 132cda6af2d5..dcb8488af4c9 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -406,10 +406,6 @@ DOMInterfaces = { 'nativeType': 'nsDOMFocusEvent', }, -'Future': { - 'implicitJSContext': [ 'constructor' ] -}, - 'GainNode': { 'resultNotAddRefed': [ 'gain' ], }, @@ -813,6 +809,10 @@ DOMInterfaces = { 'headerFile': 'nsGeolocation.h' }, +'Promise': { + 'implicitJSContext': [ 'constructor' ] +}, + 'PropertyNodeList': { 'headerFile': 'HTMLPropertiesCollection.h', 'resultNotAddRefed': [ 'item' ] @@ -933,8 +933,7 @@ DOMInterfaces = { 'SVGLengthList': { 'nativeType': 'mozilla::DOMSVGLengthList', - 'headerFile': 'DOMSVGLengthList.h', - 'resultNotAddRefed': [ 'getItem' ] + 'headerFile': 'DOMSVGLengthList.h' }, 'SVGLinearGradientElement': { @@ -947,8 +946,7 @@ DOMInterfaces = { 'SVGNumberList': { 'nativeType': 'mozilla::DOMSVGNumberList', - 'headerFile': 'DOMSVGNumberList.h', - 'resultNotAddRefed': [ 'getItem' ] + 'headerFile': 'DOMSVGNumberList.h' }, 'SVGPathSeg': { @@ -1054,8 +1052,7 @@ DOMInterfaces = { 'SVGPathSegList': { 'nativeType': 'mozilla::DOMSVGPathSegList', - 'headerFile': 'DOMSVGPathSegList.h', - 'resultNotAddRefed': [ 'getItem' ] + 'headerFile': 'DOMSVGPathSegList.h' }, 'SVGPoint': { @@ -1065,8 +1062,7 @@ DOMInterfaces = { 'SVGPointList': { 'nativeType': 'mozilla::DOMSVGPointList', - 'headerFile': 'DOMSVGPointList.h', - 'resultNotAddRefed': [ 'getItem' ] + 'headerFile': 'DOMSVGPointList.h' }, 'SVGPreserveAspectRatio': { @@ -1097,8 +1093,7 @@ DOMInterfaces = { 'SVGTransformList': { 'nativeType': 'mozilla::DOMSVGTransformList', - 'headerFile': 'DOMSVGTransformList.h', - 'resultNotAddRefed': [ 'getItem' ] + 'headerFile': 'DOMSVGTransformList.h' }, 'SVGStringList': { diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 9988398c9ed9..5c356f338b74 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -63,7 +63,7 @@ struct SetDOMProxyInformation { SetDOMProxyInformation() { js::SetDOMProxyInformation((void*) &HandlerFamily, - js::JSSLOT_PROXY_EXTRA + JSPROXYSLOT_EXPANDO, DOMProxyShadows); + js::PROXY_EXTRA_SLOT + JSPROXYSLOT_EXPANDO, DOMProxyShadows); } }; diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index 8d52ee468d89..c329a1cb090c 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -15,7 +15,7 @@ #include "xpcpublic.h" #include "nsStringGlue.h" -#define DOM_PROXY_OBJECT_SLOT js::JSSLOT_PROXY_PRIVATE +#define DOM_PROXY_OBJECT_SLOT js::PROXY_PRIVATE_SLOT namespace mozilla { namespace dom { diff --git a/dom/bindings/Makefile.in b/dom/bindings/Makefile.in index f4a52313866f..1edd2a5d7548 100644 --- a/dom/bindings/Makefile.in +++ b/dom/bindings/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ LIBRARY_NAME = dombindings_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/bindings/test/Makefile.in b/dom/bindings/test/Makefile.in index 2aacb59de809..1578f70ed8d0 100644 --- a/dom/bindings/test/Makefile.in +++ b/dom/bindings/test/Makefile.in @@ -10,7 +10,6 @@ relativesrcdir = @relativesrcdir@ LIBRARY_NAME = dombindings_test_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 # Do NOT export this library. We don't actually want our test code # being added to libxul or anything. diff --git a/dom/bluetooth/Makefile.in b/dom/bluetooth/Makefile.in index 3d9645d44bb2..dd16996fea6d 100644 --- a/dom/bluetooth/Makefile.in +++ b/dom/bluetooth/Makefile.in @@ -27,7 +27,6 @@ ifneq (,$(MOZ_B2G_BT)) LIBRARY_NAME = dombluetooth_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT)) VPATH += \ diff --git a/dom/browser-element/Makefile.in b/dom/browser-element/Makefile.in index 3c60ddfd8499..de8b43ae10cb 100644 --- a/dom/browser-element/Makefile.in +++ b/dom/browser-element/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_browserelement_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/camera/Makefile.in b/dom/camera/Makefile.in index b48832cc5359..85644a299838 100644 --- a/dom/camera/Makefile.in +++ b/dom/camera/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domcamera_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/cellbroadcast/src/Makefile.in b/dom/cellbroadcast/src/Makefile.in index e63dece92a67..658a2a1fef5a 100644 --- a/dom/cellbroadcast/src/Makefile.in +++ b/dom/cellbroadcast/src/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_cellbroadcast_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/devicestorage/Makefile.in b/dom/devicestorage/Makefile.in index 8b9d6d345fd7..d2f76809a309 100644 --- a/dom/devicestorage/Makefile.in +++ b/dom/devicestorage/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domdevicestorage_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/encoding/Makefile.in b/dom/encoding/Makefile.in index b9c542d8618d..8d624d68d205 100644 --- a/dom/encoding/Makefile.in +++ b/dom/encoding/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domencoding_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 LOCAL_INCLUDES = \ -I$(topsrcdir)/intl/locale/src \ diff --git a/dom/file/Makefile.in b/dom/file/Makefile.in index e67d175fa93b..2e7f112a29b7 100644 --- a/dom/file/Makefile.in +++ b/dom/file/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domfile_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/fm/Makefile.in b/dom/fm/Makefile.in index c7f1c00b84e0..99fe83fbcd01 100644 --- a/dom/fm/Makefile.in +++ b/dom/fm/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domfm_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/future/FutureCallback.cpp b/dom/future/FutureCallback.cpp deleted file mode 100644 index 2fd81f5efb56..000000000000 --- a/dom/future/FutureCallback.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* 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 "FutureCallback.h" -#include "mozilla/dom/Future.h" -#include "mozilla/dom/FutureResolver.h" - -namespace mozilla { -namespace dom { - -NS_IMPL_CYCLE_COLLECTING_ADDREF(FutureCallback) -NS_IMPL_CYCLE_COLLECTING_RELEASE(FutureCallback) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FutureCallback) - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FutureCallback) -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(FutureCallback) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END - -FutureCallback::FutureCallback() -{ - MOZ_COUNT_CTOR(FutureCallback); -} - -FutureCallback::~FutureCallback() -{ - MOZ_COUNT_DTOR(FutureCallback); -} - -static void -EnterCompartment(Maybe& aAc, JSContext* aCx, - const Optional >& aValue) -{ - // FIXME Bug 878849 - if (aValue.WasPassed() && aValue.Value().isObject()) { - JS::Rooted rooted(aCx, &aValue.Value().toObject()); - aAc.construct(aCx, rooted); - } -} - -// ResolveFutureCallback - -NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ResolveFutureCallback, - FutureCallback, - mResolver) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ResolveFutureCallback) -NS_INTERFACE_MAP_END_INHERITING(FutureCallback) - -NS_IMPL_ADDREF_INHERITED(ResolveFutureCallback, FutureCallback) -NS_IMPL_RELEASE_INHERITED(ResolveFutureCallback, FutureCallback) - -ResolveFutureCallback::ResolveFutureCallback(FutureResolver* aResolver) - : mResolver(aResolver) -{ - MOZ_ASSERT(aResolver); - MOZ_COUNT_CTOR(ResolveFutureCallback); -} - -ResolveFutureCallback::~ResolveFutureCallback() -{ - MOZ_COUNT_DTOR(ResolveFutureCallback); -} - -void -ResolveFutureCallback::Call(const Optional >& aValue) -{ - // Run resolver's algorithm with value and the synchronous flag set. - AutoJSContext cx; - Maybe ac; - EnterCompartment(ac, cx, aValue); - - mResolver->ResolveInternal(cx, aValue, FutureResolver::SyncTask); -} - -// RejectFutureCallback - -NS_IMPL_CYCLE_COLLECTION_INHERITED_1(RejectFutureCallback, - FutureCallback, - mResolver) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RejectFutureCallback) -NS_INTERFACE_MAP_END_INHERITING(FutureCallback) - -NS_IMPL_ADDREF_INHERITED(RejectFutureCallback, FutureCallback) -NS_IMPL_RELEASE_INHERITED(RejectFutureCallback, FutureCallback) - -RejectFutureCallback::RejectFutureCallback(FutureResolver* aResolver) - : mResolver(aResolver) -{ - MOZ_ASSERT(aResolver); - MOZ_COUNT_CTOR(RejectFutureCallback); -} - -RejectFutureCallback::~RejectFutureCallback() -{ - MOZ_COUNT_DTOR(RejectFutureCallback); -} - -void -RejectFutureCallback::Call(const Optional >& aValue) -{ - // Run resolver's algorithm with value and the synchronous flag set. - AutoJSContext cx; - Maybe ac; - EnterCompartment(ac, cx, aValue); - - mResolver->RejectInternal(cx, aValue, FutureResolver::SyncTask); -} - -// WrapperFutureCallback - -NS_IMPL_CYCLE_COLLECTION_INHERITED_2(WrapperFutureCallback, - FutureCallback, - mNextResolver, mCallback) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(WrapperFutureCallback) -NS_INTERFACE_MAP_END_INHERITING(FutureCallback) - -NS_IMPL_ADDREF_INHERITED(WrapperFutureCallback, FutureCallback) -NS_IMPL_RELEASE_INHERITED(WrapperFutureCallback, FutureCallback) - -WrapperFutureCallback::WrapperFutureCallback(FutureResolver* aNextResolver, - AnyCallback* aCallback) - : mNextResolver(aNextResolver) - , mCallback(aCallback) -{ - MOZ_ASSERT(aNextResolver); - MOZ_COUNT_CTOR(WrapperFutureCallback); -} - -WrapperFutureCallback::~WrapperFutureCallback() -{ - MOZ_COUNT_DTOR(WrapperFutureCallback); -} - -void -WrapperFutureCallback::Call(const Optional >& aValue) -{ - AutoJSContext cx; - Maybe ac; - EnterCompartment(ac, cx, aValue); - - ErrorResult rv; - - // If invoking callback threw an exception, run resolver's reject with the - // thrown exception as argument and the synchronous flag set. - Optional > value(cx, - mCallback->Call(mNextResolver->GetParentObject(), aValue, rv, - CallbackObject::eRethrowExceptions)); - - rv.WouldReportJSException(); - - if (rv.Failed() && rv.IsJSException()) { - Optional > value(cx); - rv.StealJSException(cx, &value.Value()); - - Maybe ac2; - EnterCompartment(ac2, cx, value); - mNextResolver->RejectInternal(cx, value, FutureResolver::SyncTask); - return; - } - - // Otherwise, run resolver's resolve with value and the synchronous flag - // set. - Maybe ac2; - EnterCompartment(ac2, cx, value); - mNextResolver->ResolveInternal(cx, value, FutureResolver::SyncTask); -} - -// SimpleWrapperFutureCallback - -NS_IMPL_CYCLE_COLLECTION_INHERITED_2(SimpleWrapperFutureCallback, - FutureCallback, - mFuture, mCallback) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SimpleWrapperFutureCallback) -NS_INTERFACE_MAP_END_INHERITING(FutureCallback) - -NS_IMPL_ADDREF_INHERITED(SimpleWrapperFutureCallback, FutureCallback) -NS_IMPL_RELEASE_INHERITED(SimpleWrapperFutureCallback, FutureCallback) - -SimpleWrapperFutureCallback::SimpleWrapperFutureCallback(Future* aFuture, - AnyCallback* aCallback) - : mFuture(aFuture) - , mCallback(aCallback) -{ - MOZ_ASSERT(aFuture); - MOZ_COUNT_CTOR(SimpleWrapperFutureCallback); -} - -SimpleWrapperFutureCallback::~SimpleWrapperFutureCallback() -{ - MOZ_COUNT_DTOR(SimpleWrapperFutureCallback); -} - -void -SimpleWrapperFutureCallback::Call(const Optional >& aValue) -{ - ErrorResult rv; - mCallback->Call(mFuture, aValue, rv); -} - -/* static */ FutureCallback* -FutureCallback::Factory(FutureResolver* aNextResolver, - AnyCallback* aCallback, Task aTask) -{ - MOZ_ASSERT(aNextResolver); - - // If we have a callback and a next resolver, we have to exec the callback and - // then propagate the return value to the next resolver->resolve(). - if (aCallback) { - return new WrapperFutureCallback(aNextResolver, aCallback); - } - - if (aTask == Resolve) { - return new ResolveFutureCallback(aNextResolver); - } - - if (aTask == Reject) { - return new RejectFutureCallback(aNextResolver); - } - - MOZ_ASSERT(false, "This should not happen"); - return nullptr; -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/future/FutureCallback.h b/dom/future/FutureCallback.h deleted file mode 100644 index cd823ae64ad5..000000000000 --- a/dom/future/FutureCallback.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* 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 mozilla_dom_FutureCallback_h -#define mozilla_dom_FutureCallback_h - -#include "mozilla/dom/Future.h" -#include "nsCycleCollectionParticipant.h" - -namespace mozilla { -namespace dom { - -class FutureResolver; - -// This is the base class for any FutureCallback. -// It's a logical step in the future chain of callbacks. -class FutureCallback : public nsISupports -{ -public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(FutureCallback) - - FutureCallback(); - virtual ~FutureCallback(); - - virtual void Call(const Optional >& aValue) = 0; - - enum Task { - Resolve, - Reject - }; - - // This factory returns a FutureCallback object with refcount of 0. - static FutureCallback* - Factory(FutureResolver* aNextResolver, AnyCallback* aCallback, - Task aTask); -}; - -// WrapperFutureCallback execs a JS Callback with a value, and then the return -// value is sent to the aNextResolver->resolve() or to aNextResolver->Reject() -// if the JS Callback throws. -class WrapperFutureCallback MOZ_FINAL : public FutureCallback -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WrapperFutureCallback, - FutureCallback) - - void Call(const Optional >& aValue) MOZ_OVERRIDE; - - WrapperFutureCallback(FutureResolver* aNextResolver, - AnyCallback* aCallback); - ~WrapperFutureCallback(); - -private: - nsRefPtr mNextResolver; - nsRefPtr mCallback; -}; - -// SimpleWrapperFutureCallback execs a JS Callback with a value. -class SimpleWrapperFutureCallback MOZ_FINAL : public FutureCallback -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SimpleWrapperFutureCallback, - FutureCallback) - - void Call(const Optional >& aValue) MOZ_OVERRIDE; - - SimpleWrapperFutureCallback(Future* aFuture, - AnyCallback* aCallback); - ~SimpleWrapperFutureCallback(); - -private: - nsRefPtr mFuture; - nsRefPtr mCallback; -}; - -// ResolveFutureCallback calls aResolver->Resolve() with the value received by -// Call(). -class ResolveFutureCallback MOZ_FINAL : public FutureCallback -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ResolveFutureCallback, - FutureCallback) - - void Call(const Optional >& aValue) MOZ_OVERRIDE; - - ResolveFutureCallback(FutureResolver* aResolver); - ~ResolveFutureCallback(); - -private: - nsRefPtr mResolver; -}; - -// RejectFutureCallback calls aResolver->Reject() with the value received by -// Call(). -class RejectFutureCallback MOZ_FINAL : public FutureCallback -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RejectFutureCallback, - FutureCallback) - - void Call(const Optional >& aValue) MOZ_OVERRIDE; - - RejectFutureCallback(FutureResolver* aResolver); - ~RejectFutureCallback(); - -private: - nsRefPtr mResolver; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_FutureCallback_h diff --git a/dom/future/FutureResolver.cpp b/dom/future/FutureResolver.cpp deleted file mode 100644 index 64e79a67b91c..000000000000 --- a/dom/future/FutureResolver.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* 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 "mozilla/dom/FutureResolver.h" -#include "mozilla/dom/FutureBinding.h" -#include "mozilla/dom/Future.h" -#include "FutureCallback.h" - -namespace mozilla { -namespace dom { - -// FutureResolverTask - -// This class processes the future's callbacks with future's result. -class FutureResolverTask MOZ_FINAL : public nsRunnable -{ -public: - FutureResolverTask(FutureResolver* aResolver, - const JS::Handle aValue, - Future::FutureState aState) - : mResolver(aResolver) - , mValue(aValue) - , mState(aState) - { - MOZ_ASSERT(aResolver); - MOZ_ASSERT(mState != Future::Pending); - MOZ_COUNT_CTOR(FutureResolverTask); - - JSContext* cx = nsContentUtils::GetSafeJSContext(); - JS_AddNamedValueRootRT(JS_GetRuntime(cx), &mValue, - "FutureResolverTask.mValue"); - } - - ~FutureResolverTask() - { - MOZ_COUNT_DTOR(FutureResolverTask); - - JSContext* cx = nsContentUtils::GetSafeJSContext(); - JS_RemoveValueRootRT(JS_GetRuntime(cx), &mValue); - } - - NS_IMETHOD Run() - { - mResolver->RunTask(JS::Handle::fromMarkedLocation(&mValue), - mState, FutureResolver::SyncTask); - return NS_OK; - } - -private: - nsRefPtr mResolver; - JS::Value mValue; - Future::FutureState mState; -}; - -// FutureResolver - -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(FutureResolver, mFuture) - -NS_IMPL_CYCLE_COLLECTING_ADDREF(FutureResolver) -NS_IMPL_CYCLE_COLLECTING_RELEASE(FutureResolver) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FutureResolver) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END - -FutureResolver::FutureResolver(Future* aFuture) - : mFuture(aFuture) - , mResolvePending(false) -{ - SetIsDOMBinding(); -} - -JSObject* -FutureResolver::WrapObject(JSContext* aCx, JS::Handle aScope) -{ - return FutureResolverBinding::Wrap(aCx, aScope, this); -} - -void -FutureResolver::Resolve(JSContext* aCx, - const Optional >& aValue, - FutureTaskSync aAsynchronous) -{ - if (mResolvePending) { - return; - } - - ResolveInternal(aCx, aValue, aAsynchronous); -} - -void -FutureResolver::ResolveInternal(JSContext* aCx, - const Optional >& aValue, - FutureTaskSync aAsynchronous) -{ - mResolvePending = true; - - // TODO: Bug 879245 - Then-able objects - if (aValue.WasPassed() && aValue.Value().isObject()) { - JS::Rooted valueObj(aCx, &aValue.Value().toObject()); - Future* nextFuture; - nsresult rv = UnwrapObject(aCx, valueObj, nextFuture); - - if (NS_SUCCEEDED(rv)) { - nsRefPtr resolveCb = new ResolveFutureCallback(this); - nsRefPtr rejectCb = new RejectFutureCallback(this); - nextFuture->AppendCallbacks(resolveCb, rejectCb); - return; - } - } - - // If the synchronous flag is set, process future's resolve callbacks with - // value. Otherwise, the synchronous flag is unset, queue a task to process - // future's resolve callbacks with value. Otherwise, the synchronous flag is - // unset, queue a task to process future's resolve callbacks with value. - RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue, - Future::Resolved, aAsynchronous); -} - -void -FutureResolver::Reject(JSContext* aCx, - const Optional >& aValue, - FutureTaskSync aAsynchronous) -{ - if (mResolvePending) { - return; - } - - RejectInternal(aCx, aValue, aAsynchronous); -} - -void -FutureResolver::RejectInternal(JSContext* aCx, - const Optional >& aValue, - FutureTaskSync aAsynchronous) -{ - mResolvePending = true; - - // If the synchronous flag is set, process future's reject callbacks with - // value. Otherwise, the synchronous flag is unset, queue a task to process - // future's reject callbacks with value. - RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue, - Future::Rejected, aAsynchronous); -} - -void -FutureResolver::RunTask(JS::Handle aValue, - Future::FutureState aState, - FutureTaskSync aAsynchronous) -{ - // If the synchronous flag is unset, queue a task to process future's - // accept callbacks with value. - if (aAsynchronous == AsyncTask) { - nsRefPtr task = - new FutureResolverTask(this, aValue, aState); - NS_DispatchToCurrentThread(task); - return; - } - - mFuture->SetResult(aValue); - mFuture->SetState(aState); - mFuture->RunTask(); - mFuture = nullptr; -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/icc/src/Makefile.in b/dom/icc/src/Makefile.in index a2fed74976c6..c271e775a7bd 100644 --- a/dom/icc/src/Makefile.in +++ b/dom/icc/src/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_icc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/indexedDB/IDBEvents.cpp b/dom/indexedDB/IDBEvents.cpp index 8a321072b7ea..8fbfe6b15014 100644 --- a/dom/indexedDB/IDBEvents.cpp +++ b/dom/indexedDB/IDBEvents.cpp @@ -16,6 +16,8 @@ USING_INDEXEDDB_NAMESPACE using namespace mozilla::dom; +NS_DEFINE_STATIC_IID_ACCESSOR(IDBVersionChangeEvent, IDBVERSIONCHANGEEVENT_IID) + namespace { class EventFiringRunnable : public nsRunnable @@ -95,29 +97,5 @@ NS_IMPL_ADDREF_INHERITED(IDBVersionChangeEvent, nsDOMEvent) NS_IMPL_RELEASE_INHERITED(IDBVersionChangeEvent, nsDOMEvent) NS_INTERFACE_MAP_BEGIN(IDBVersionChangeEvent) - NS_INTERFACE_MAP_ENTRY(nsIIDBVersionChangeEvent) + NS_INTERFACE_MAP_ENTRY(IDBVersionChangeEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) - -NS_IMETHODIMP -IDBVersionChangeEvent::GetOldVersion(uint64_t* aOldVersion) -{ - NS_ENSURE_ARG_POINTER(aOldVersion); - *aOldVersion = mOldVersion; - return NS_OK; -} - -NS_IMETHODIMP -IDBVersionChangeEvent::GetNewVersion(JSContext* aCx, - JS::Value* aNewVersion) -{ - NS_ENSURE_ARG_POINTER(aNewVersion); - - if (!mNewVersion) { - *aNewVersion = JSVAL_NULL; - } - else { - *aNewVersion = JS_NumberValue(double(mNewVersion)); - } - - return NS_OK; -} diff --git a/dom/indexedDB/IDBEvents.h b/dom/indexedDB/IDBEvents.h index fe838c9a7954..b6f3353a7421 100644 --- a/dom/indexedDB/IDBEvents.h +++ b/dom/indexedDB/IDBEvents.h @@ -9,7 +9,6 @@ #include "mozilla/dom/indexedDB/IndexedDatabase.h" -#include "nsIIDBVersionChangeEvent.h" #include "nsIRunnable.h" #include "nsDOMEvent.h" @@ -25,6 +24,10 @@ #define BLOCKED_EVT_STR "blocked" #define UPGRADENEEDED_EVT_STR "upgradeneeded" +#define IDBVERSIONCHANGEEVENT_IID \ + { 0x3b65d4c3, 0x73ad, 0x492e, \ + { 0xb1, 0x2d, 0x15, 0xf9, 0xda, 0xc2, 0x08, 0x4b } } + BEGIN_INDEXEDDB_NAMESPACE enum Bubbles { @@ -43,13 +46,12 @@ CreateGenericEvent(mozilla::dom::EventTarget* aOwner, Bubbles aBubbles, Cancelable aCancelable); -class IDBVersionChangeEvent : public nsDOMEvent, - public nsIIDBVersionChangeEvent +class IDBVersionChangeEvent : public nsDOMEvent { public: NS_DECL_ISUPPORTS_INHERITED NS_FORWARD_TO_NSDOMEVENT - NS_DECL_NSIIDBVERSIONCHANGEEVENT + NS_DECLARE_STATIC_IID_ACCESSOR(IDBVERSIONCHANGEEVENT_IID) virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE diff --git a/dom/indexedDB/Makefile.in b/dom/indexedDB/Makefile.in index 9f2bec084581..53958a42363b 100644 --- a/dom/indexedDB/Makefile.in +++ b/dom/indexedDB/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_indexeddb_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 LOCAL_INCLUDES = \ diff --git a/dom/indexedDB/ipc/IndexedDBParent.cpp b/dom/indexedDB/ipc/IndexedDBParent.cpp index 914036632a93..fa383911bb72 100644 --- a/dom/indexedDB/ipc/IndexedDBParent.cpp +++ b/dom/indexedDB/ipc/IndexedDBParent.cpp @@ -8,7 +8,6 @@ #include "nsIDOMFile.h" #include "nsIDOMEvent.h" -#include "nsIIDBVersionChangeEvent.h" #include "nsIXPConnect.h" #include "mozilla/AppProcessChecker.h" @@ -369,12 +368,10 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent, if (aType.EqualsLiteral(BLOCKED_EVT_STR)) { MOZ_ASSERT(!mDatabase); - nsCOMPtr changeEvent = do_QueryInterface(aEvent); + nsCOMPtr changeEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE); - uint64_t oldVersion; - rv = changeEvent->GetOldVersion(&oldVersion); - NS_ENSURE_SUCCESS(rv, rv); + uint64_t oldVersion = changeEvent->OldVersion(); if (!SendBlocked(oldVersion)) { return NS_ERROR_FAILURE; @@ -480,12 +477,10 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent, return NS_ERROR_FAILURE; } - nsCOMPtr changeEvent = do_QueryInterface(aEvent); + nsCOMPtr changeEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE); - uint64_t oldVersion; - rv = changeEvent->GetOldVersion(&oldVersion); - NS_ENSURE_SUCCESS(rv, rv); + uint64_t oldVersion = changeEvent->OldVersion(); nsAutoPtr actor( new IndexedDBVersionChangeTransactionParent()); @@ -521,30 +516,23 @@ IndexedDBDatabaseParent::HandleDatabaseEvent(nsIDOMEvent* aEvent, "Should never get error events in the parent process!"); MOZ_ASSERT(!IsDisconnected()); - nsresult rv; - if (aType.EqualsLiteral(VERSIONCHANGE_EVT_STR)) { AutoSafeJSContext cx; NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE); - nsCOMPtr changeEvent = do_QueryInterface(aEvent); + nsCOMPtr changeEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE); - uint64_t oldVersion; - rv = changeEvent->GetOldVersion(&oldVersion); - NS_ENSURE_SUCCESS(rv, rv); + uint64_t oldVersion = changeEvent->OldVersion(); - JS::Rooted newVersionVal(cx); - rv = changeEvent->GetNewVersion(cx, newVersionVal.address()); - NS_ENSURE_SUCCESS(rv, rv); + Nullable newVersionVal = changeEvent->GetNewVersion(); uint64_t newVersion; - if (newVersionVal.isNull()) { + if (newVersionVal.IsNull()) { newVersion = 0; } else { - MOZ_ASSERT(newVersionVal.isNumber()); - newVersion = static_cast(newVersionVal.toNumber()); + newVersion = newVersionVal.Value(); } if (!SendVersionChange(oldVersion, newVersion)) { @@ -2112,12 +2100,10 @@ IndexedDBDeleteDatabaseRequestParent::HandleEvent(nsIDOMEvent* aEvent) NS_ENSURE_SUCCESS(rv, rv); if (type.EqualsASCII(BLOCKED_EVT_STR)) { - nsCOMPtr event = do_QueryInterface(aEvent); + nsCOMPtr event = do_QueryInterface(aEvent); MOZ_ASSERT(event); - uint64_t currentVersion; - rv = event->GetOldVersion(¤tVersion); - NS_ENSURE_SUCCESS(rv, rv); + uint64_t currentVersion = event->OldVersion(); if (!SendBlocked(currentVersion)) { return NS_ERROR_FAILURE; diff --git a/dom/indexedDB/ipc/Makefile.in b/dom/indexedDB/ipc/Makefile.in index 1560cdf0cc0e..bbc9f6a9df84 100644 --- a/dom/indexedDB/ipc/Makefile.in +++ b/dom/indexedDB/ipc/Makefile.in @@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_indexeddb_ipc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 LOCAL_INCLUDES += \ -I$(topsrcdir)/dom/indexedDB \ diff --git a/dom/indexedDB/moz.build b/dom/indexedDB/moz.build index 4a2452b723f8..ff37559bc925 100644 --- a/dom/indexedDB/moz.build +++ b/dom/indexedDB/moz.build @@ -17,7 +17,6 @@ XPIDL_SOURCES += [ 'nsIIDBOpenDBRequest.idl', 'nsIIDBRequest.idl', 'nsIIDBTransaction.idl', - 'nsIIDBVersionChangeEvent.idl', 'nsIIndexedDatabaseManager.idl', ] diff --git a/dom/indexedDB/nsIIDBVersionChangeEvent.idl b/dom/indexedDB/nsIIDBVersionChangeEvent.idl deleted file mode 100644 index 9732bdea8358..000000000000 --- a/dom/indexedDB/nsIIDBVersionChangeEvent.idl +++ /dev/null @@ -1,16 +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 "nsIDOMEvent.idl" - -[scriptable, builtinclass, uuid(08a6b8b1-92fa-4f80-98cc-370143b11ff3)] -interface nsIIDBVersionChangeEvent : nsIDOMEvent -{ - readonly attribute unsigned long long oldVersion; - - [implicit_jscontext] - readonly attribute jsval newVersion; -}; diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 9bd0abacc2bf..cd6c811ee447 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -827,7 +827,8 @@ interface nsIDOMWindowUtils : nsISupports { in long aCaretLength); /** - * Synthesize a query content event. + * Synthesize a query content event. Note that the result value returned here + * is in LayoutDevice pixels rather than CSS pixels. * * @param aType One of the following const values. And see also each comment * for the other parameters and the result. diff --git a/dom/interfaces/devicestorage/Makefile.in b/dom/interfaces/devicestorage/Makefile.in index 250734e239fe..94cd8d2b636b 100644 --- a/dom/interfaces/devicestorage/Makefile.in +++ b/dom/interfaces/devicestorage/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domdevicestorage_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/ipc/Makefile.in b/dom/ipc/Makefile.in index ebc1d64c1fd4..2159ed493af8 100644 --- a/dom/ipc/Makefile.in +++ b/dom/ipc/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domipc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/locales/en-US/chrome/accessibility/AccessFu.properties b/dom/locales/en-US/chrome/accessibility/AccessFu.properties index 193d52ddd019..6810ed726498 100644 --- a/dom/locales/en-US/chrome/accessibility/AccessFu.properties +++ b/dom/locales/en-US/chrome/accessibility/AccessFu.properties @@ -143,6 +143,7 @@ quicknav_Simple = Default quicknav_Anchor = Anchors quicknav_Button = Buttons quicknav_Combobox = Combo boxes +quicknav_Landmark = Landmarks quicknav_Entry = Entries quicknav_FormElement = Form elements quicknav_Graphic = Images diff --git a/dom/media/Makefile.in b/dom/media/Makefile.in index 85a83b494a08..143d11475185 100644 --- a/dom/media/Makefile.in +++ b/dom/media/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_media_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/mobilemessage/src/Makefile.in b/dom/mobilemessage/src/Makefile.in index 7c9797b42c78..58f42e3c27da 100644 --- a/dom/mobilemessage/src/Makefile.in +++ b/dom/mobilemessage/src/Makefile.in @@ -23,7 +23,6 @@ endif LIBRARY_NAME = dom_mobilemessage_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/moz.build b/dom/moz.build index 0f5199a217fe..f49b4f51745e 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -71,7 +71,7 @@ PARALLEL_DIRS += [ 'workers', 'camera', 'audiochannel', - 'future', + 'promise', 'wappush' ] diff --git a/dom/network/src/Makefile.in b/dom/network/src/Makefile.in index 64041d247bda..cce9ca571d22 100644 --- a/dom/network/src/Makefile.in +++ b/dom/network/src/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_network_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/plugins/base/android/Makefile.in b/dom/plugins/base/android/Makefile.in index 5643eaeaa951..456d71721802 100644 --- a/dom/plugins/base/android/Makefile.in +++ b/dom/plugins/base/android/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkpluginandroid_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/plugins/ipc/Makefile.in b/dom/plugins/ipc/Makefile.in index 5b35713eb772..c65f020c9655 100644 --- a/dom/plugins/ipc/Makefile.in +++ b/dom/plugins/ipc/Makefile.in @@ -13,7 +13,6 @@ FAIL_ON_WARNINGS := 1 LIBRARY_NAME = domplugins_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 ifeq (WINNT,$(OS_ARCH)) diff --git a/dom/plugins/ipc/hangui/plugin-hang-ui.exe.manifest b/dom/plugins/ipc/hangui/plugin-hang-ui.exe.manifest index 004e47d35ebb..eab2b0ef4c30 100644 --- a/dom/plugins/ipc/hangui/plugin-hang-ui.exe.manifest +++ b/dom/plugins/ipc/hangui/plugin-hang-ui.exe.manifest @@ -28,8 +28,10 @@ - - + + + + diff --git a/dom/power/Makefile.in b/dom/power/Makefile.in index 749052f3351f..d498ba459e51 100644 --- a/dom/power/Makefile.in +++ b/dom/power/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_power_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/future/Makefile.in b/dom/promise/Makefile.in similarity index 90% rename from dom/future/Makefile.in rename to dom/promise/Makefile.in index efb3d474e2a6..fdab90659e19 100644 --- a/dom/future/Makefile.in +++ b/dom/promise/Makefile.in @@ -9,9 +9,8 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -LIBRARY_NAME = domfuture_s +LIBRARY_NAME = dompromise_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/config/config.mk diff --git a/dom/future/Future.cpp b/dom/promise/Promise.cpp similarity index 53% rename from dom/future/Future.cpp rename to dom/promise/Promise.cpp index 1bb40df0b389..8d303db640da 100644 --- a/dom/future/Future.cpp +++ b/dom/promise/Promise.cpp @@ -4,49 +4,49 @@ * License, v. 2.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/Future.h" -#include "mozilla/dom/FutureBinding.h" -#include "mozilla/dom/FutureResolver.h" +#include "mozilla/dom/Promise.h" +#include "mozilla/dom/PromiseBinding.h" +#include "mozilla/dom/PromiseResolver.h" #include "mozilla/Preferences.h" -#include "FutureCallback.h" +#include "PromiseCallback.h" #include "nsContentUtils.h" #include "nsPIDOMWindow.h" namespace mozilla { namespace dom { -// FutureTask +// PromiseTask -// This class processes the future's callbacks with future's result. -class FutureTask MOZ_FINAL : public nsRunnable +// This class processes the promise's callbacks with promise's result. +class PromiseTask MOZ_FINAL : public nsRunnable { public: - FutureTask(Future* aFuture) - : mFuture(aFuture) + PromiseTask(Promise* aPromise) + : mPromise(aPromise) { - MOZ_ASSERT(aFuture); - MOZ_COUNT_CTOR(FutureTask); + MOZ_ASSERT(aPromise); + MOZ_COUNT_CTOR(PromiseTask); } - ~FutureTask() + ~PromiseTask() { - MOZ_COUNT_DTOR(FutureTask); + MOZ_COUNT_DTOR(PromiseTask); } NS_IMETHOD Run() { - mFuture->mTaskPending = false; - mFuture->RunTask(); + mPromise->mTaskPending = false; + mPromise->RunTask(); return NS_OK; } private: - nsRefPtr mFuture; + nsRefPtr mPromise; }; -// Future +// Promise -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Future) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Promise) NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow) NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolver) NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolveCallbacks); @@ -55,7 +55,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Future) NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Future) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Promise) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResolver) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResolveCallbacks); @@ -63,49 +63,49 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Future) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Future) +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Promise) NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mResult) NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_TRACE_END -NS_IMPL_CYCLE_COLLECTING_ADDREF(Future) -NS_IMPL_CYCLE_COLLECTING_RELEASE(Future) +NS_IMPL_CYCLE_COLLECTING_ADDREF(Promise) +NS_IMPL_CYCLE_COLLECTING_RELEASE(Promise) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Future) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Promise) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -Future::Future(nsPIDOMWindow* aWindow) +Promise::Promise(nsPIDOMWindow* aWindow) : mWindow(aWindow) , mResult(JS::UndefinedValue()) , mState(Pending) , mTaskPending(false) { - MOZ_COUNT_CTOR(Future); - NS_HOLD_JS_OBJECTS(this, Future); + MOZ_COUNT_CTOR(Promise); + NS_HOLD_JS_OBJECTS(this, Promise); SetIsDOMBinding(); - mResolver = new FutureResolver(this); + mResolver = new PromiseResolver(this); } -Future::~Future() +Promise::~Promise() { mResult = JSVAL_VOID; - NS_DROP_JS_OBJECTS(this, Future); - MOZ_COUNT_DTOR(Future); + NS_DROP_JS_OBJECTS(this, Promise); + MOZ_COUNT_DTOR(Promise); } JSObject* -Future::WrapObject(JSContext* aCx, JS::Handle aScope) +Promise::WrapObject(JSContext* aCx, JS::Handle aScope) { - return FutureBinding::Wrap(aCx, aScope, this); + return PromiseBinding::Wrap(aCx, aScope, this); } /* static */ bool -Future::PrefEnabled() +Promise::PrefEnabled() { - return Preferences::GetBool("dom.future.enabled", false); + return Preferences::GetBool("dom.promise.enabled", false); } static void @@ -119,9 +119,9 @@ EnterCompartment(Maybe& aAc, JSContext* aCx, } } -/* static */ already_AddRefed -Future::Constructor(const GlobalObject& aGlobal, JSContext* aCx, - FutureInit& aInit, ErrorResult& aRv) +/* static */ already_AddRefed +Promise::Constructor(const GlobalObject& aGlobal, JSContext* aCx, + PromiseInit& aInit, ErrorResult& aRv) { MOZ_ASSERT(PrefEnabled()); @@ -131,9 +131,9 @@ Future::Constructor(const GlobalObject& aGlobal, JSContext* aCx, return nullptr; } - nsRefPtr future = new Future(window); + nsRefPtr promise = new Promise(window); - aInit.Call(future, *future->mResolver, aRv, + aInit.Call(promise, *promise->mResolver, aRv, CallbackObject::eRethrowExceptions); aRv.WouldReportJSException(); @@ -143,15 +143,15 @@ Future::Constructor(const GlobalObject& aGlobal, JSContext* aCx, Maybe ac; EnterCompartment(ac, aCx, value); - future->mResolver->Reject(aCx, value); + promise->mResolver->Reject(aCx, value); } - return future.forget(); + return promise.forget(); } -/* static */ already_AddRefed -Future::Resolve(const GlobalObject& aGlobal, JSContext* aCx, - JS::Handle aValue, ErrorResult& aRv) +/* static */ already_AddRefed +Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx, + JS::Handle aValue, ErrorResult& aRv) { MOZ_ASSERT(PrefEnabled()); @@ -161,16 +161,16 @@ Future::Resolve(const GlobalObject& aGlobal, JSContext* aCx, return nullptr; } - nsRefPtr future = new Future(window); + nsRefPtr promise = new Promise(window); Optional > value(aCx, aValue); - future->mResolver->Resolve(aCx, value); - return future.forget(); + promise->mResolver->Resolve(aCx, value); + return promise.forget(); } -/* static */ already_AddRefed -Future::Reject(const GlobalObject& aGlobal, JSContext* aCx, - JS::Handle aValue, ErrorResult& aRv) +/* static */ already_AddRefed +Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx, + JS::Handle aValue, ErrorResult& aRv) { MOZ_ASSERT(PrefEnabled()); @@ -180,62 +180,62 @@ Future::Reject(const GlobalObject& aGlobal, JSContext* aCx, return nullptr; } - nsRefPtr future = new Future(window); + nsRefPtr promise = new Promise(window); Optional > value(aCx, aValue); - future->mResolver->Reject(aCx, value); - return future.forget(); + promise->mResolver->Reject(aCx, value); + return promise.forget(); } -already_AddRefed -Future::Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback) +already_AddRefed +Promise::Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback) { - nsRefPtr future = new Future(GetParentObject()); + nsRefPtr promise = new Promise(GetParentObject()); - nsRefPtr resolveCb = - FutureCallback::Factory(future->mResolver, - aResolveCallback, - FutureCallback::Resolve); + nsRefPtr resolveCb = + PromiseCallback::Factory(promise->mResolver, + aResolveCallback, + PromiseCallback::Resolve); - nsRefPtr rejectCb = - FutureCallback::Factory(future->mResolver, - aRejectCallback, - FutureCallback::Reject); + nsRefPtr rejectCb = + PromiseCallback::Factory(promise->mResolver, + aRejectCallback, + PromiseCallback::Reject); AppendCallbacks(resolveCb, rejectCb); - return future.forget(); + return promise.forget(); } -already_AddRefed -Future::Catch(AnyCallback* aRejectCallback) +already_AddRefed +Promise::Catch(AnyCallback* aRejectCallback) { return Then(nullptr, aRejectCallback); } void -Future::Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback) +Promise::Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback) { if (!aResolveCallback && !aRejectCallback) { return; } - nsRefPtr resolveCb; + nsRefPtr resolveCb; if (aResolveCallback) { - resolveCb = new SimpleWrapperFutureCallback(this, aResolveCallback); + resolveCb = new SimpleWrapperPromiseCallback(this, aResolveCallback); } - nsRefPtr rejectCb; + nsRefPtr rejectCb; if (aRejectCallback) { - rejectCb = new SimpleWrapperFutureCallback(this, aRejectCallback); + rejectCb = new SimpleWrapperPromiseCallback(this, aRejectCallback); } AppendCallbacks(resolveCb, rejectCb); } void -Future::AppendCallbacks(FutureCallback* aResolveCallback, - FutureCallback* aRejectCallback) +Promise::AppendCallbacks(PromiseCallback* aResolveCallback, + PromiseCallback* aRejectCallback) { if (aResolveCallback) { mResolveCallbacks.AppendElement(aResolveCallback); @@ -245,22 +245,22 @@ Future::AppendCallbacks(FutureCallback* aResolveCallback, mRejectCallbacks.AppendElement(aRejectCallback); } - // If future's state is resolved, queue a task to process future's resolve - // callbacks with future's result. If future's state is rejected, queue a task - // to process future's reject callbacks with future's result. + // If promise's state is resolved, queue a task to process promise's resolve + // callbacks with promise's result. If promise's state is rejected, queue a task + // to process promise's reject callbacks with promise's result. if (mState != Pending && !mTaskPending) { - nsRefPtr task = new FutureTask(this); + nsRefPtr task = new PromiseTask(this); NS_DispatchToCurrentThread(task); mTaskPending = true; } } void -Future::RunTask() +Promise::RunTask() { MOZ_ASSERT(mState != Pending); - nsTArray > callbacks; + nsTArray > callbacks; callbacks.SwapElements(mState == Resolved ? mResolveCallbacks : mRejectCallbacks); mResolveCallbacks.Clear(); diff --git a/dom/future/Future.h b/dom/promise/Promise.h similarity index 59% rename from dom/future/Future.h rename to dom/promise/Promise.h index a52621ad1a3c..7baa6457d96e 100644 --- a/dom/future/Future.h +++ b/dom/promise/Promise.h @@ -4,14 +4,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/. */ -#ifndef mozilla_dom_Future_h -#define mozilla_dom_Future_h +#ifndef mozilla_dom_Promise_h +#define mozilla_dom_Promise_h #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingDeclarations.h" #include "nsCycleCollectionParticipant.h" -#include "mozilla/dom/FutureBinding.h" +#include "mozilla/dom/PromiseBinding.h" #include "nsWrapperCache.h" #include "nsAutoPtr.h" @@ -21,24 +21,24 @@ class nsPIDOMWindow; namespace mozilla { namespace dom { -class FutureInit; -class FutureCallback; +class PromiseInit; +class PromiseCallback; class AnyCallback; -class FutureResolver; +class PromiseResolver; -class Future MOZ_FINAL : public nsISupports, - public nsWrapperCache +class Promise MOZ_FINAL : public nsISupports, + public nsWrapperCache { - friend class FutureTask; - friend class FutureResolver; - friend class FutureResolverTask; + friend class PromiseTask; + friend class PromiseResolver; + friend class PromiseResolverTask; public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Future) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Promise) - Future(nsPIDOMWindow* aWindow); - ~Future(); + Promise(nsPIDOMWindow* aWindow); + ~Promise(); static bool PrefEnabled(); @@ -52,34 +52,34 @@ class Future MOZ_FINAL : public nsISupports, virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; - static already_AddRefed - Constructor(const GlobalObject& aGlobal, JSContext* aCx, FutureInit& aInit, + static already_AddRefed + Constructor(const GlobalObject& aGlobal, JSContext* aCx, PromiseInit& aInit, ErrorResult& aRv); - static already_AddRefed + static already_AddRefed Resolve(const GlobalObject& aGlobal, JSContext* aCx, JS::Handle aValue, ErrorResult& aRv); - static already_AddRefed + static already_AddRefed Reject(const GlobalObject& aGlobal, JSContext* aCx, JS::Handle aValue, ErrorResult& aRv); - already_AddRefed + already_AddRefed Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback); - already_AddRefed + already_AddRefed Catch(AnyCallback* aRejectCallback); void Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback); private: - enum FutureState { + enum PromiseState { Pending, Resolved, Rejected }; - void SetState(FutureState aState) + void SetState(PromiseState aState) { MOZ_ASSERT(mState == Pending); MOZ_ASSERT(aState != Pending); @@ -91,28 +91,28 @@ class Future MOZ_FINAL : public nsISupports, mResult = aValue; } - // This method processes future's resolve/reject callbacks with future's + // This method processes promise's resolve/reject callbacks with promise's // result. It's executed when the resolver.resolve() or resolver.reject() is - // called or when the future already has a result and new callbacks are + // called or when the promise already has a result and new callbacks are // appended by then(), catch() or done(). void RunTask(); - void AppendCallbacks(FutureCallback* aResolveCallback, - FutureCallback* aRejectCallback); + void AppendCallbacks(PromiseCallback* aResolveCallback, + PromiseCallback* aRejectCallback); nsRefPtr mWindow; - nsRefPtr mResolver; + nsRefPtr mResolver; - nsTArray > mResolveCallbacks; - nsTArray > mRejectCallbacks; + nsTArray > mResolveCallbacks; + nsTArray > mRejectCallbacks; JS::Heap mResult; - FutureState mState; + PromiseState mState; bool mTaskPending; }; } // namespace dom } // namespace mozilla -#endif // mozilla_dom_Future_h +#endif // mozilla_dom_Promise_h diff --git a/dom/promise/PromiseCallback.cpp b/dom/promise/PromiseCallback.cpp new file mode 100644 index 000000000000..4110fa6d0909 --- /dev/null +++ b/dom/promise/PromiseCallback.cpp @@ -0,0 +1,236 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* 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 "PromiseCallback.h" +#include "mozilla/dom/Promise.h" +#include "mozilla/dom/PromiseResolver.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTING_ADDREF(PromiseCallback) +NS_IMPL_CYCLE_COLLECTING_RELEASE(PromiseCallback) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PromiseCallback) + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(PromiseCallback) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(PromiseCallback) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +PromiseCallback::PromiseCallback() +{ + MOZ_COUNT_CTOR(PromiseCallback); +} + +PromiseCallback::~PromiseCallback() +{ + MOZ_COUNT_DTOR(PromiseCallback); +} + +static void +EnterCompartment(Maybe& aAc, JSContext* aCx, + const Optional >& aValue) +{ + // FIXME Bug 878849 + if (aValue.WasPassed() && aValue.Value().isObject()) { + JS::Rooted rooted(aCx, &aValue.Value().toObject()); + aAc.construct(aCx, rooted); + } +} + +// ResolvePromiseCallback + +NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ResolvePromiseCallback, + PromiseCallback, + mResolver) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ResolvePromiseCallback) +NS_INTERFACE_MAP_END_INHERITING(PromiseCallback) + +NS_IMPL_ADDREF_INHERITED(ResolvePromiseCallback, PromiseCallback) +NS_IMPL_RELEASE_INHERITED(ResolvePromiseCallback, PromiseCallback) + +ResolvePromiseCallback::ResolvePromiseCallback(PromiseResolver* aResolver) + : mResolver(aResolver) +{ + MOZ_ASSERT(aResolver); + MOZ_COUNT_CTOR(ResolvePromiseCallback); +} + +ResolvePromiseCallback::~ResolvePromiseCallback() +{ + MOZ_COUNT_DTOR(ResolvePromiseCallback); +} + +void +ResolvePromiseCallback::Call(const Optional >& aValue) +{ + // Run resolver's algorithm with value and the synchronous flag set. + AutoJSContext cx; + Maybe ac; + EnterCompartment(ac, cx, aValue); + + mResolver->ResolveInternal(cx, aValue, PromiseResolver::SyncTask); +} + +// RejectPromiseCallback + +NS_IMPL_CYCLE_COLLECTION_INHERITED_1(RejectPromiseCallback, + PromiseCallback, + mResolver) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RejectPromiseCallback) +NS_INTERFACE_MAP_END_INHERITING(PromiseCallback) + +NS_IMPL_ADDREF_INHERITED(RejectPromiseCallback, PromiseCallback) +NS_IMPL_RELEASE_INHERITED(RejectPromiseCallback, PromiseCallback) + +RejectPromiseCallback::RejectPromiseCallback(PromiseResolver* aResolver) + : mResolver(aResolver) +{ + MOZ_ASSERT(aResolver); + MOZ_COUNT_CTOR(RejectPromiseCallback); +} + +RejectPromiseCallback::~RejectPromiseCallback() +{ + MOZ_COUNT_DTOR(RejectPromiseCallback); +} + +void +RejectPromiseCallback::Call(const Optional >& aValue) +{ + // Run resolver's algorithm with value and the synchronous flag set. + AutoJSContext cx; + Maybe ac; + EnterCompartment(ac, cx, aValue); + + mResolver->RejectInternal(cx, aValue, PromiseResolver::SyncTask); +} + +// WrapperPromiseCallback + +NS_IMPL_CYCLE_COLLECTION_INHERITED_2(WrapperPromiseCallback, + PromiseCallback, + mNextResolver, mCallback) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(WrapperPromiseCallback) +NS_INTERFACE_MAP_END_INHERITING(PromiseCallback) + +NS_IMPL_ADDREF_INHERITED(WrapperPromiseCallback, PromiseCallback) +NS_IMPL_RELEASE_INHERITED(WrapperPromiseCallback, PromiseCallback) + +WrapperPromiseCallback::WrapperPromiseCallback(PromiseResolver* aNextResolver, + AnyCallback* aCallback) + : mNextResolver(aNextResolver) + , mCallback(aCallback) +{ + MOZ_ASSERT(aNextResolver); + MOZ_COUNT_CTOR(WrapperPromiseCallback); +} + +WrapperPromiseCallback::~WrapperPromiseCallback() +{ + MOZ_COUNT_DTOR(WrapperPromiseCallback); +} + +void +WrapperPromiseCallback::Call(const Optional >& aValue) +{ + AutoJSContext cx; + Maybe ac; + EnterCompartment(ac, cx, aValue); + + ErrorResult rv; + + // If invoking callback threw an exception, run resolver's reject with the + // thrown exception as argument and the synchronous flag set. + Optional > value(cx, + mCallback->Call(mNextResolver->GetParentObject(), aValue, rv, + CallbackObject::eRethrowExceptions)); + + rv.WouldReportJSException(); + + if (rv.Failed() && rv.IsJSException()) { + Optional > value(cx); + rv.StealJSException(cx, &value.Value()); + + Maybe ac2; + EnterCompartment(ac2, cx, value); + mNextResolver->RejectInternal(cx, value, PromiseResolver::SyncTask); + return; + } + + // Otherwise, run resolver's resolve with value and the synchronous flag + // set. + Maybe ac2; + EnterCompartment(ac2, cx, value); + mNextResolver->ResolveInternal(cx, value, PromiseResolver::SyncTask); +} + +// SimpleWrapperPromiseCallback + +NS_IMPL_CYCLE_COLLECTION_INHERITED_2(SimpleWrapperPromiseCallback, + PromiseCallback, + mPromise, mCallback) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SimpleWrapperPromiseCallback) +NS_INTERFACE_MAP_END_INHERITING(PromiseCallback) + +NS_IMPL_ADDREF_INHERITED(SimpleWrapperPromiseCallback, PromiseCallback) +NS_IMPL_RELEASE_INHERITED(SimpleWrapperPromiseCallback, PromiseCallback) + +SimpleWrapperPromiseCallback::SimpleWrapperPromiseCallback(Promise* aPromise, + AnyCallback* aCallback) + : mPromise(aPromise) + , mCallback(aCallback) +{ + MOZ_ASSERT(aPromise); + MOZ_COUNT_CTOR(SimpleWrapperPromiseCallback); +} + +SimpleWrapperPromiseCallback::~SimpleWrapperPromiseCallback() +{ + MOZ_COUNT_DTOR(SimpleWrapperPromiseCallback); +} + +void +SimpleWrapperPromiseCallback::Call(const Optional >& aValue) +{ + ErrorResult rv; + mCallback->Call(mPromise, aValue, rv); +} + +/* static */ PromiseCallback* +PromiseCallback::Factory(PromiseResolver* aNextResolver, + AnyCallback* aCallback, Task aTask) +{ + MOZ_ASSERT(aNextResolver); + + // If we have a callback and a next resolver, we have to exec the callback and + // then propagate the return value to the next resolver->resolve(). + if (aCallback) { + return new WrapperPromiseCallback(aNextResolver, aCallback); + } + + if (aTask == Resolve) { + return new ResolvePromiseCallback(aNextResolver); + } + + if (aTask == Reject) { + return new RejectPromiseCallback(aNextResolver); + } + + MOZ_ASSERT(false, "This should not happen"); + return nullptr; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/promise/PromiseCallback.h b/dom/promise/PromiseCallback.h new file mode 100644 index 000000000000..14aa3145edcb --- /dev/null +++ b/dom/promise/PromiseCallback.h @@ -0,0 +1,121 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* 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 mozilla_dom_PromiseCallback_h +#define mozilla_dom_PromiseCallback_h + +#include "mozilla/dom/Promise.h" +#include "nsCycleCollectionParticipant.h" + +namespace mozilla { +namespace dom { + +class PromiseResolver; + +// This is the base class for any PromiseCallback. +// It's a logical step in the promise chain of callbacks. +class PromiseCallback : public nsISupports +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS(PromiseCallback) + + PromiseCallback(); + virtual ~PromiseCallback(); + + virtual void Call(const Optional >& aValue) = 0; + + enum Task { + Resolve, + Reject + }; + + // This factory returns a PromiseCallback object with refcount of 0. + static PromiseCallback* + Factory(PromiseResolver* aNextResolver, AnyCallback* aCallback, + Task aTask); +}; + +// WrapperPromiseCallback execs a JS Callback with a value, and then the return +// value is sent to the aNextResolver->resolve() or to aNextResolver->Reject() +// if the JS Callback throws. +class WrapperPromiseCallback MOZ_FINAL : public PromiseCallback +{ +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WrapperPromiseCallback, + PromiseCallback) + + void Call(const Optional >& aValue) MOZ_OVERRIDE; + + WrapperPromiseCallback(PromiseResolver* aNextResolver, + AnyCallback* aCallback); + ~WrapperPromiseCallback(); + +private: + nsRefPtr mNextResolver; + nsRefPtr mCallback; +}; + +// SimpleWrapperPromiseCallback execs a JS Callback with a value. +class SimpleWrapperPromiseCallback MOZ_FINAL : public PromiseCallback +{ +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SimpleWrapperPromiseCallback, + PromiseCallback) + + void Call(const Optional >& aValue) MOZ_OVERRIDE; + + SimpleWrapperPromiseCallback(Promise* aPromise, + AnyCallback* aCallback); + ~SimpleWrapperPromiseCallback(); + +private: + nsRefPtr mPromise; + nsRefPtr mCallback; +}; + +// ResolvePromiseCallback calls aResolver->Resolve() with the value received by +// Call(). +class ResolvePromiseCallback MOZ_FINAL : public PromiseCallback +{ +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ResolvePromiseCallback, + PromiseCallback) + + void Call(const Optional >& aValue) MOZ_OVERRIDE; + + ResolvePromiseCallback(PromiseResolver* aResolver); + ~ResolvePromiseCallback(); + +private: + nsRefPtr mResolver; +}; + +// RejectPromiseCallback calls aResolver->Reject() with the value received by +// Call(). +class RejectPromiseCallback MOZ_FINAL : public PromiseCallback +{ +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RejectPromiseCallback, + PromiseCallback) + + void Call(const Optional >& aValue) MOZ_OVERRIDE; + + RejectPromiseCallback(PromiseResolver* aResolver); + ~RejectPromiseCallback(); + +private: + nsRefPtr mResolver; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_PromiseCallback_h diff --git a/dom/promise/PromiseResolver.cpp b/dom/promise/PromiseResolver.cpp new file mode 100644 index 000000000000..e34354d04f45 --- /dev/null +++ b/dom/promise/PromiseResolver.cpp @@ -0,0 +1,171 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* 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 "mozilla/dom/PromiseResolver.h" +#include "mozilla/dom/PromiseBinding.h" +#include "mozilla/dom/Promise.h" +#include "PromiseCallback.h" + +namespace mozilla { +namespace dom { + +// PromiseResolverTask + +// This class processes the promise's callbacks with promise's result. +class PromiseResolverTask MOZ_FINAL : public nsRunnable +{ +public: + PromiseResolverTask(PromiseResolver* aResolver, + const JS::Handle aValue, + Promise::PromiseState aState) + : mResolver(aResolver) + , mValue(aValue) + , mState(aState) + { + MOZ_ASSERT(aResolver); + MOZ_ASSERT(mState != Promise::Pending); + MOZ_COUNT_CTOR(PromiseResolverTask); + + JSContext* cx = nsContentUtils::GetSafeJSContext(); + JS_AddNamedValueRootRT(JS_GetRuntime(cx), &mValue, + "PromiseResolverTask.mValue"); + } + + ~PromiseResolverTask() + { + MOZ_COUNT_DTOR(PromiseResolverTask); + + JSContext* cx = nsContentUtils::GetSafeJSContext(); + JS_RemoveValueRootRT(JS_GetRuntime(cx), &mValue); + } + + NS_IMETHOD Run() + { + mResolver->RunTask(JS::Handle::fromMarkedLocation(&mValue), + mState, PromiseResolver::SyncTask); + return NS_OK; + } + +private: + nsRefPtr mResolver; + JS::Value mValue; + Promise::PromiseState mState; +}; + +// PromiseResolver + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(PromiseResolver, mPromise) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(PromiseResolver) +NS_IMPL_CYCLE_COLLECTING_RELEASE(PromiseResolver) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PromiseResolver) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +PromiseResolver::PromiseResolver(Promise* aPromise) + : mPromise(aPromise) + , mResolvePending(false) +{ + SetIsDOMBinding(); +} + +JSObject* +PromiseResolver::WrapObject(JSContext* aCx, JS::Handle aScope) +{ + return PromiseResolverBinding::Wrap(aCx, aScope, this); +} + +void +PromiseResolver::Resolve(JSContext* aCx, + const Optional >& aValue, + PromiseTaskSync aAsynchronous) +{ + if (mResolvePending) { + return; + } + + ResolveInternal(aCx, aValue, aAsynchronous); +} + +void +PromiseResolver::ResolveInternal(JSContext* aCx, + const Optional >& aValue, + PromiseTaskSync aAsynchronous) +{ + mResolvePending = true; + + // TODO: Bug 879245 - Then-able objects + if (aValue.WasPassed() && aValue.Value().isObject()) { + JS::Rooted valueObj(aCx, &aValue.Value().toObject()); + Promise* nextPromise; + nsresult rv = UnwrapObject(aCx, valueObj, nextPromise); + + if (NS_SUCCEEDED(rv)) { + nsRefPtr resolveCb = new ResolvePromiseCallback(this); + nsRefPtr rejectCb = new RejectPromiseCallback(this); + nextPromise->AppendCallbacks(resolveCb, rejectCb); + return; + } + } + + // If the synchronous flag is set, process promise's resolve callbacks with + // value. Otherwise, the synchronous flag is unset, queue a task to process + // promise's resolve callbacks with value. Otherwise, the synchronous flag is + // unset, queue a task to process promise's resolve callbacks with value. + RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue, + Promise::Resolved, aAsynchronous); +} + +void +PromiseResolver::Reject(JSContext* aCx, + const Optional >& aValue, + PromiseTaskSync aAsynchronous) +{ + if (mResolvePending) { + return; + } + + RejectInternal(aCx, aValue, aAsynchronous); +} + +void +PromiseResolver::RejectInternal(JSContext* aCx, + const Optional >& aValue, + PromiseTaskSync aAsynchronous) +{ + mResolvePending = true; + + // If the synchronous flag is set, process promise's reject callbacks with + // value. Otherwise, the synchronous flag is unset, queue a task to process + // promise's reject callbacks with value. + RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue, + Promise::Rejected, aAsynchronous); +} + +void +PromiseResolver::RunTask(JS::Handle aValue, + Promise::PromiseState aState, + PromiseTaskSync aAsynchronous) +{ + // If the synchronous flag is unset, queue a task to process promise's + // accept callbacks with value. + if (aAsynchronous == AsyncTask) { + nsRefPtr task = + new PromiseResolverTask(this, aValue, aState); + NS_DispatchToCurrentThread(task); + return; + } + + mPromise->SetResult(aValue); + mPromise->SetState(aState); + mPromise->RunTask(); + mPromise = nullptr; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/future/FutureResolver.h b/dom/promise/PromiseResolver.h similarity index 57% rename from dom/future/FutureResolver.h rename to dom/promise/PromiseResolver.h index 5e651cd69833..49977537460d 100644 --- a/dom/future/FutureResolver.h +++ b/dom/promise/PromiseResolver.h @@ -4,10 +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/. */ -#ifndef mozilla_dom_FutureResolver_h -#define mozilla_dom_FutureResolver_h +#ifndef mozilla_dom_PromiseResolver_h +#define mozilla_dom_PromiseResolver_h -#include "mozilla/dom/Future.h" +#include "mozilla/dom/Promise.h" #include "mozilla/Attributes.h" #include "mozilla/dom/BindingDeclarations.h" #include "nsCycleCollectionParticipant.h" @@ -18,53 +18,53 @@ struct JSContext; namespace mozilla { namespace dom { -class FutureResolver MOZ_FINAL : public nsISupports, - public nsWrapperCache +class PromiseResolver MOZ_FINAL : public nsISupports, + public nsWrapperCache { - friend class FutureResolverTask; - friend class WrapperFutureCallback; - friend class ResolveFutureCallback; - friend class RejectFutureCallback; + friend class PromiseResolverTask; + friend class WrapperPromiseCallback; + friend class ResolvePromiseCallback; + friend class RejectPromiseCallback; private: - enum FutureTaskSync { + enum PromiseTaskSync { SyncTask, AsyncTask }; public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FutureResolver) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PromiseResolver) - FutureResolver(Future* aFuture); + PromiseResolver(Promise* aPromise); - Future* GetParentObject() const + Promise* GetParentObject() const { - return mFuture; + return mPromise; } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; void Resolve(JSContext* aCx, const Optional >& aValue, - FutureTaskSync aSync = AsyncTask); + PromiseTaskSync aSync = AsyncTask); void Reject(JSContext* aCx, const Optional >& aValue, - FutureTaskSync aSync = AsyncTask); + PromiseTaskSync aSync = AsyncTask); private: void ResolveInternal(JSContext* aCx, const Optional >& aValue, - FutureTaskSync aSync = AsyncTask); + PromiseTaskSync aSync = AsyncTask); void RejectInternal(JSContext* aCx, const Optional >& aValue, - FutureTaskSync aSync = AsyncTask); + PromiseTaskSync aSync = AsyncTask); void RunTask(JS::Handle aValue, - Future::FutureState aState, FutureTaskSync aSync); + Promise::PromiseState aState, PromiseTaskSync aSync); - nsRefPtr mFuture; + nsRefPtr mPromise; bool mResolvePending; }; @@ -72,4 +72,4 @@ class FutureResolver MOZ_FINAL : public nsISupports, } // namespace dom } // namespace mozilla -#endif // mozilla_dom_FutureResolver_h +#endif // mozilla_dom_PromiseResolver_h diff --git a/dom/future/moz.build b/dom/promise/moz.build similarity index 73% rename from dom/future/moz.build rename to dom/promise/moz.build index 04c28eb311cd..e3074a1360d8 100644 --- a/dom/future/moz.build +++ b/dom/promise/moz.build @@ -6,17 +6,17 @@ TEST_DIRS += ['tests'] -XPIDL_MODULE = 'dom_future' +XPIDL_MODULE = 'dom_promise' MODULE = 'dom' EXPORTS.mozilla.dom += [ - 'Future.h', - 'FutureResolver.h', + 'Promise.h', + 'PromiseResolver.h', ] CPP_SOURCES += [ - 'Future.cpp', - 'FutureResolver.cpp', - 'FutureCallback.cpp', + 'Promise.cpp', + 'PromiseResolver.cpp', + 'PromiseCallback.cpp', ] diff --git a/dom/future/tests/Makefile.in b/dom/promise/tests/Makefile.in similarity index 95% rename from dom/future/tests/Makefile.in rename to dom/promise/tests/Makefile.in index 0c1e3479dee8..7df9c9f0d068 100644 --- a/dom/future/tests/Makefile.in +++ b/dom/promise/tests/Makefile.in @@ -12,7 +12,7 @@ relativesrcdir = @relativesrcdir@ include $(DEPTH)/config/autoconf.mk MOCHITEST_FILES = \ - test_future.html \ + test_promise.html \ test_resolve.html \ test_bug883683.html \ $(NULL) diff --git a/dom/future/tests/moz.build b/dom/promise/tests/moz.build similarity index 100% rename from dom/future/tests/moz.build rename to dom/promise/tests/moz.build diff --git a/dom/future/tests/test_bug883683.html b/dom/promise/tests/test_bug883683.html similarity index 71% rename from dom/future/tests/test_bug883683.html rename to dom/promise/tests/test_bug883683.html index 3404e7c1ff4e..b1bdcf22bf35 100644 --- a/dom/future/tests/test_bug883683.html +++ b/dom/promise/tests/test_bug883683.html @@ -4,7 +4,7 @@ --> - Future - bug 883683 + Promise - bug 883683 @@ -17,23 +17,23 @@ diff --git a/dom/future/tests/test_future.html b/dom/promise/tests/test_promise.html similarity index 60% rename from dom/future/tests/test_future.html rename to dom/promise/tests/test_promise.html index 9c6f6cf8179f..a367736a3702 100644 --- a/dom/future/tests/test_future.html +++ b/dom/promise/tests/test_promise.html @@ -4,7 +4,7 @@ --> - Basic Future Test + Basic Promise Test @@ -16,13 +16,13 @@
 
 
diff --git a/dom/future/tests/test_resolve.html b/dom/promise/tests/test_resolve.html similarity index 85% rename from dom/future/tests/test_resolve.html rename to dom/promise/tests/test_resolve.html index 9c4a046ad072..114b41556909 100644 --- a/dom/future/tests/test_resolve.html +++ b/dom/promise/tests/test_resolve.html @@ -4,7 +4,7 @@ --> - Future.resolve(anything) Test + Promise.resolve(anything) Test @@ -44,12 +44,12 @@ var test = tests.pop(); - new Future(function(resolver) { + new Promise(function(resolver) { resolver.resolve(test); }).then(function(what) { ok(test === what, "What is: " + what); }, cbError).done(function() { - new Future(function(resolver) { + new Promise(function(resolver) { resolver.reject(test) }).then(cbError, function(what) { ok(test === what, "What is: " + what); @@ -58,7 +58,7 @@ } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.future.enabled", true]]}, runTest); +SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest); // --> diff --git a/dom/quota/Makefile.in b/dom/quota/Makefile.in index c1cdd8796374..1f0a98bf2c7a 100644 --- a/dom/quota/Makefile.in +++ b/dom/quota/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domquota_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/src/events/Makefile.in b/dom/src/events/Makefile.in index 38501ec0499f..fd9745eac083 100644 --- a/dom/src/events/Makefile.in +++ b/dom/src/events/Makefile.in @@ -14,9 +14,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += -I$(topsrcdir)/dom/base diff --git a/dom/src/geolocation/Makefile.in b/dom/src/geolocation/Makefile.in index d0589025f9c3..a16f71d8b205 100644 --- a/dom/src/geolocation/Makefile.in +++ b/dom/src/geolocation/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdomgeolocation_s LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 LOCAL_INCLUDES = \ diff --git a/dom/src/json/Makefile.in b/dom/src/json/Makefile.in index cd89640da659..c5ff6f9c1e31 100644 --- a/dom/src/json/Makefile.in +++ b/dom/src/json/Makefile.in @@ -13,9 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 - -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../base \ -I$(topsrcdir)/content/events/src diff --git a/dom/src/jsurl/Makefile.in b/dom/src/jsurl/Makefile.in index 3ea28df02680..28770ed69b38 100644 --- a/dom/src/jsurl/Makefile.in +++ b/dom/src/jsurl/Makefile.in @@ -11,7 +11,6 @@ FAIL_ON_WARNINGS := 1 include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES += \ diff --git a/dom/src/notification/Makefile.in b/dom/src/notification/Makefile.in index 505d4d86e653..1c509fda82e4 100644 --- a/dom/src/notification/Makefile.in +++ b/dom/src/notification/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdomnotification_s LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 LOCAL_INCLUDES = \ diff --git a/dom/src/offline/Makefile.in b/dom/src/offline/Makefile.in index e411bf2f9189..a527d6a374d9 100644 --- a/dom/src/offline/Makefile.in +++ b/dom/src/offline/Makefile.in @@ -13,9 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/content/base/src \ diff --git a/dom/src/storage/Makefile.in b/dom/src/storage/Makefile.in index ea29f30e8f7a..fc7b514e4a67 100644 --- a/dom/src/storage/Makefile.in +++ b/dom/src/storage/Makefile.in @@ -15,9 +15,6 @@ LIBRARY_NAME = jsdomstorage_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/content/events/src diff --git a/dom/system/Makefile.in b/dom/system/Makefile.in index 00ecde4333dd..adf9beeea120 100644 --- a/dom/system/Makefile.in +++ b/dom/system/Makefile.in @@ -47,7 +47,6 @@ include $(topsrcdir)/config/config.mk # we don't want the shared lib, but we want to force the creation of a static lib. LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/dom/system/android/Makefile.in b/dom/system/android/Makefile.in index eb9bd9fbb594..7cbf2188bea9 100644 --- a/dom/system/android/Makefile.in +++ b/dom/system/android/Makefile.in @@ -13,7 +13,6 @@ LIBRARY_NAME = domsystemandroid_s # we don't want the shared lib, but we want to force the creation of a static lib. LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/system/gonk/Makefile.in b/dom/system/gonk/Makefile.in index 2e10af42b83b..ffa78c0c7988 100644 --- a/dom/system/gonk/Makefile.in +++ b/dom/system/gonk/Makefile.in @@ -23,7 +23,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domsystemgonk_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/system/unix/Makefile.in b/dom/system/unix/Makefile.in index 0ecbfcc0dd9d..c5e1630df7eb 100644 --- a/dom/system/unix/Makefile.in +++ b/dom/system/unix/Makefile.in @@ -13,7 +13,6 @@ LIBRARY_NAME = domsystemunix_s # we don't want the shared lib, but we want to force the creation of a static lib. LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/system/windows/Makefile.in b/dom/system/windows/Makefile.in index 40eeb21781aa..ed022043c095 100644 --- a/dom/system/windows/Makefile.in +++ b/dom/system/windows/Makefile.in @@ -13,7 +13,6 @@ LIBRARY_NAME = domsystemwindows_s # we don't want the shared lib, but we want to force the creation of a static lib. LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/telephony/Makefile.in b/dom/telephony/Makefile.in index c5f133971537..7b47c9360ae2 100644 --- a/dom/telephony/Makefile.in +++ b/dom/telephony/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domtelephony_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/time/Makefile.in b/dom/time/Makefile.in index 07cf3a2e21c6..413b83546337 100644 --- a/dom/time/Makefile.in +++ b/dom/time/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = dom_time_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/voicemail/Makefile.in b/dom/voicemail/Makefile.in index dbd90461c926..5da1f55de226 100644 --- a/dom/voicemail/Makefile.in +++ b/dom/voicemail/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domvoicemail_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/webidl/Future.webidl b/dom/webidl/Promise.webidl similarity index 59% rename from dom/webidl/Future.webidl rename to dom/webidl/Promise.webidl index 54d86e0a07e5..b74649aec3cb 100644 --- a/dom/webidl/Future.webidl +++ b/dom/webidl/Promise.webidl @@ -4,32 +4,32 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is - * http://dom.spec.whatwg.org/#futures + * http://dom.spec.whatwg.org/#promises */ -interface FutureResolver { +interface PromiseResolver { void resolve(optional any value); void reject(optional any value); }; -callback FutureInit = void (FutureResolver resolver); +callback PromiseInit = void (PromiseResolver resolver); callback AnyCallback = any (optional any value); -[PrefControlled, Constructor(FutureInit init)] -interface Future { +[PrefControlled, Constructor(PromiseInit init)] +interface Promise { // TODO: update this interface - bug 875289 [Creator, Throws] - static Future resolve(any value); // same as any(value) + static Promise resolve(any value); // same as any(value) [Creator, Throws] - static Future reject(any value); + static Promise reject(any value); [Creator] - Future then(optional AnyCallback? resolveCallback = null, - optional AnyCallback? rejectCallback = null); + Promise then(optional AnyCallback? resolveCallback = null, + optional AnyCallback? rejectCallback = null); [Creator] - Future catch(optional AnyCallback? rejectCallback = null); + Promise catch(optional AnyCallback? rejectCallback = null); void done(optional AnyCallback? resolveCallback = null, optional AnyCallback? rejectCallback = null); diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index 6c03cb89324c..2763dce7fde4 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -87,7 +87,6 @@ webidl_files = \ FocusEvent.webidl \ FormData.webidl \ Function.webidl \ - Future.webidl \ GainNode.webidl \ Geolocation.webidl \ HTMLAnchorElement.webidl \ @@ -215,6 +214,7 @@ webidl_files = \ Position.webidl \ PositionError.webidl \ ProcessingInstruction.webidl \ + Promise.webidl \ Range.webidl \ Rect.webidl \ RGBColor.webidl \ diff --git a/dom/wifi/Makefile.in b/dom/wifi/Makefile.in index d0d91c2674da..3f1c2dd4fa43 100644 --- a/dom/wifi/Makefile.in +++ b/dom/wifi/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domwifi_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/dom/dom-config.mk diff --git a/dom/workers/Makefile.in b/dom/workers/Makefile.in index abc98f3ab9ac..9e901ac69a99 100644 --- a/dom/workers/Makefile.in +++ b/dom/workers/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 LOCAL_INCLUDES = \ diff --git a/editor/libeditor/base/Makefile.in b/editor/libeditor/base/Makefile.in index 78ce8166bb43..743a9d36e431 100644 --- a/editor/libeditor/base/Makefile.in +++ b/editor/libeditor/base/Makefile.in @@ -17,9 +17,6 @@ FAIL_ON_WARNINGS = 1 # Internal header files, needed by other editor sublibs: INTERNAL_HDR_DIR = ../internal -# don't want the shared lib; force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/editor/libeditor/html/Makefile.in b/editor/libeditor/html/Makefile.in index 396629d73ab2..563663147be3 100644 --- a/editor/libeditor/html/Makefile.in +++ b/editor/libeditor/html/Makefile.in @@ -22,9 +22,6 @@ endif DEFINES += -D_IMPL_NS_LAYOUT -# don't want the shared lib; force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += -I$(topsrcdir)/editor/libeditor/base \ diff --git a/editor/libeditor/text/Makefile.in b/editor/libeditor/text/Makefile.in index 4842b6803d38..abf29f57fbc2 100644 --- a/editor/libeditor/text/Makefile.in +++ b/editor/libeditor/text/Makefile.in @@ -13,9 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# don't want the shared lib; force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/editor/txtsvc/src/Makefile.in b/editor/txtsvc/src/Makefile.in index c8c22a1bb008..58dd5e52834c 100644 --- a/editor/txtsvc/src/Makefile.in +++ b/editor/txtsvc/src/Makefile.in @@ -11,7 +11,6 @@ FAIL_ON_WARNINGS = 1 include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/embedding/browser/webBrowser/Makefile.in b/embedding/browser/webBrowser/Makefile.in index 1c03b264badb..c102390464be 100644 --- a/embedding/browser/webBrowser/Makefile.in +++ b/embedding/browser/webBrowser/Makefile.in @@ -19,8 +19,4 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../../content/svg/content/src \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/appstartup/src/Makefile.in b/embedding/components/appstartup/src/Makefile.in index 97b298bfadc4..a688d9264c3a 100644 --- a/embedding/components/appstartup/src/Makefile.in +++ b/embedding/components/appstartup/src/Makefile.in @@ -13,9 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/commandhandler/src/Makefile.in b/embedding/components/commandhandler/src/Makefile.in index 97b298bfadc4..a688d9264c3a 100644 --- a/embedding/components/commandhandler/src/Makefile.in +++ b/embedding/components/commandhandler/src/Makefile.in @@ -13,9 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/commandhandler/src/nsCommandParams.cpp b/embedding/components/commandhandler/src/nsCommandParams.cpp index bca3a8facd6c..489952f4d1d4 100644 --- a/embedding/components/commandhandler/src/nsCommandParams.cpp +++ b/embedding/components/commandhandler/src/nsCommandParams.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "xpcom-config.h" -#include NEW_H // for placement new +#include // for placement new #include "nscore.h" #include "nsCRT.h" diff --git a/embedding/components/find/src/Makefile.in b/embedding/components/find/src/Makefile.in index 97b298bfadc4..a688d9264c3a 100644 --- a/embedding/components/find/src/Makefile.in +++ b/embedding/components/find/src/Makefile.in @@ -13,9 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/printingui/src/mac/Makefile.in b/embedding/components/printingui/src/mac/Makefile.in index f040df871eec..d28673d00abe 100644 --- a/embedding/components/printingui/src/mac/Makefile.in +++ b/embedding/components/printingui/src/mac/Makefile.in @@ -19,9 +19,5 @@ FAIL_ON_WARNINGS = 1 LOCAL_INCLUDES = \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/printingui/src/os2/Makefile.in b/embedding/components/printingui/src/os2/Makefile.in index e710e153df6a..d04671e0e073 100644 --- a/embedding/components/printingui/src/os2/Makefile.in +++ b/embedding/components/printingui/src/os2/Makefile.in @@ -13,9 +13,5 @@ include $(DEPTH)/config/autoconf.mk EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/printingui/src/unixshared/Makefile.in b/embedding/components/printingui/src/unixshared/Makefile.in index f698cb578170..766378c7d0ab 100644 --- a/embedding/components/printingui/src/unixshared/Makefile.in +++ b/embedding/components/printingui/src/unixshared/Makefile.in @@ -14,9 +14,5 @@ EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/printingui/src/win/Makefile.in b/embedding/components/printingui/src/win/Makefile.in index f698cb578170..766378c7d0ab 100644 --- a/embedding/components/printingui/src/win/Makefile.in +++ b/embedding/components/printingui/src/win/Makefile.in @@ -14,9 +14,5 @@ EXPORT_LIBRARY = .. LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/webbrowserpersist/src/Makefile.in b/embedding/components/webbrowserpersist/src/Makefile.in index 97b298bfadc4..a688d9264c3a 100644 --- a/embedding/components/webbrowserpersist/src/Makefile.in +++ b/embedding/components/webbrowserpersist/src/Makefile.in @@ -13,9 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/windowwatcher/src/Makefile.in b/embedding/components/windowwatcher/src/Makefile.in index 26be09244f4d..34e87f5c6e03 100644 --- a/embedding/components/windowwatcher/src/Makefile.in +++ b/embedding/components/windowwatcher/src/Makefile.in @@ -13,10 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - # For nsJSUtils LOCAL_INCLUDES += -I$(topsrcdir)/dom/base \ diff --git a/extensions/spellcheck/hunspell/src/Makefile.in b/extensions/spellcheck/hunspell/src/Makefile.in index ddaddede2934..12625a2edb70 100644 --- a/extensions/spellcheck/hunspell/src/Makefile.in +++ b/extensions/spellcheck/hunspell/src/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/extensions/universalchardet/src/base/Makefile.in b/extensions/universalchardet/src/base/Makefile.in index 9666019f3f57..104378a1773a 100644 --- a/extensions/universalchardet/src/base/Makefile.in +++ b/extensions/universalchardet/src/base/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/gfx/cairo/cairo/src/Makefile.in b/gfx/cairo/cairo/src/Makefile.in index 708243b99195..6b1337866369 100644 --- a/gfx/cairo/cairo/src/Makefile.in +++ b/gfx/cairo/cairo/src/Makefile.in @@ -173,8 +173,6 @@ endif LOCAL_INCLUDES += -I$(srcdir) -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk ifdef GNU_CC diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index a341b84261f6..97256f8abe56 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -150,8 +150,6 @@ endif LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../../cairo/src -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 3300e4f03369..8a9fc6781cce 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -625,24 +625,11 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) #ifdef XP_MACOSX if (mWorkAroundDriverBugs) { if (mVendor == VendorIntel) { - SInt32 major, minor; - OSErr err1 = ::Gestalt(gestaltSystemVersionMajor, &major); - OSErr err2 = ::Gestalt(gestaltSystemVersionMinor, &minor); - - // For 2D textures, see bug 737182 for the original restriction to 4K and - // see bug 807096 for why we further restricted it to 2K on < 10.8 - // For good measure, we align renderbuffers on what we do for 2D textures - if (err1 != noErr || err2 != noErr || - major < 10 || (major == 10 && minor < 8)) { - mMaxTextureSize = std::min(mMaxTextureSize, 2048); - mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 2048); - } - else { - mMaxTextureSize = std::min(mMaxTextureSize, 4096); - mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 4096); - } - // For cube map textures, see bug 684882. + // see bug 737182 for 2D textures, bug 684882 for cube map textures. + mMaxTextureSize = std::min(mMaxTextureSize, 4096); mMaxCubeMapTextureSize = std::min(mMaxCubeMapTextureSize, 512); + // for good measure, we align renderbuffers on what we do for 2D textures + mMaxRenderbufferSize = std::min(mMaxRenderbufferSize, 4096); mNeedsTextureSizeChecks = true; } else if (mVendor == VendorNVIDIA) { SInt32 major, minor; diff --git a/gfx/graphite2/src/Makefile.in b/gfx/graphite2/src/Makefile.in index 38b7daa095e9..2f031238b1b0 100644 --- a/gfx/graphite2/src/Makefile.in +++ b/gfx/graphite2/src/Makefile.in @@ -26,13 +26,13 @@ MSVC_ENABLE_PGO := 1 # on Windows, we're going to link graphite with gkmedias instead of libxul ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = +FORCE_STATIC_LIB = 1 else LIBXUL_LIBRARY = 1 endif # MSVC doesn't like the paths in _SOURCES, so strip off the prefix # and leave bare filenames -FORCE_STATIC_LIB = 1 FORCE_USE_PIC = 1 ifeq (WINNT,$(OS_TARGET)) diff --git a/gfx/harfbuzz/src/Makefile.in b/gfx/harfbuzz/src/Makefile.in index c86193e2c3ab..f7479e374271 100644 --- a/gfx/harfbuzz/src/Makefile.in +++ b/gfx/harfbuzz/src/Makefile.in @@ -35,11 +35,12 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 ifneq ($(OS_ARCH),WINNT) LIBXUL_LIBRARY = 1 +else +FORCE_STATIC_LIB = 1 endif LOCAL_INCLUDES += -I$(srcdir) -FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk diff --git a/gfx/ipc/Makefile.in b/gfx/ipc/Makefile.in index aab4a99e9969..85d20ca031b9 100644 --- a/gfx/ipc/Makefile.in +++ b/gfx/ipc/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gfxipc_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/gfx/layers/Makefile.in b/gfx/layers/Makefile.in index 4b4d38541ca9..79c066d58fa3 100644 --- a/gfx/layers/Makefile.in +++ b/gfx/layers/Makefile.in @@ -23,9 +23,7 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = layers MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 -DEFINES += -DIMPL_THEBES ifdef MOZ_DEBUG DEFINES += -DD3D_DEBUG_INFO endif diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 90a55496e044..7524d91521c3 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -400,6 +400,7 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, float& aScaleY, bool aDrawingCritical) { + aScaleX = aScaleY = 1.0; #ifdef MOZ_WIDGET_ANDROID Layer* primaryScrollable = GetPrimaryScrollableLayer(); if (primaryScrollable) { diff --git a/gfx/ots/src/Makefile.in b/gfx/ots/src/Makefile.in index 0486f83682d7..ff582f524ffb 100644 --- a/gfx/ots/src/Makefile.in +++ b/gfx/ots/src/Makefile.in @@ -33,10 +33,10 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = +FORCE_STATIC_LIB = 1 else LIBXUL_LIBRARY = 1 endif diff --git a/gfx/qcms/Makefile.in b/gfx/qcms/Makefile.in index 625d025b2a1f..1bf4698994a0 100644 --- a/gfx/qcms/Makefile.in +++ b/gfx/qcms/Makefile.in @@ -57,8 +57,6 @@ endif endif endif -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk CFLAGS += -DMOZ_QCMS diff --git a/gfx/src/Makefile.in b/gfx/src/Makefile.in index 152e55d1f587..b6881a508c3d 100644 --- a/gfx/src/Makefile.in +++ b/gfx/src/Makefile.in @@ -31,4 +31,3 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),qt) CXXFLAGS += $(MOZ_QT_CFLAGS) endif -DEFINES += -D_IMPL_NS_GFX diff --git a/gfx/thebes/Makefile.in b/gfx/thebes/Makefile.in index 10899c0eb08f..388969f79b6b 100644 --- a/gfx/thebes/Makefile.in +++ b/gfx/thebes/Makefile.in @@ -53,7 +53,6 @@ DEFINES += -DMOZ_USING_ANDROID_JAVA_WIDGETS endif DEFINES += \ - -DIMPL_THEBES \ -DHB_DONT_DEFINE_STDINT \ -DMOZ_OTS_REPORT_ERRORS \ -DGRAPHITE2_STATIC \ diff --git a/gfx/ycbcr/Makefile.in b/gfx/ycbcr/Makefile.in index bd1487c62a67..c800ccf8b2d9 100644 --- a/gfx/ycbcr/Makefile.in +++ b/gfx/ycbcr/Makefile.in @@ -8,8 +8,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 -DEFINES += -D_IMPL_NS_GFX - include $(topsrcdir)/config/rules.mk # These files use MMX and SSE2 intrinsics, so they need special compile flags diff --git a/hal/Makefile.in b/hal/Makefile.in index 1fc11f9386a3..1c393da459fe 100644 --- a/hal/Makefile.in +++ b/hal/Makefile.in @@ -22,7 +22,6 @@ relativesrcdir = @relativesrcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = hal_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/decoders/Makefile.in b/image/decoders/Makefile.in index c23e5926d969..8fc0569e1f71 100644 --- a/image/decoders/Makefile.in +++ b/image/decoders/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/decoders/icon/android/Makefile.in b/image/decoders/icon/android/Makefile.in index f46d73036a8b..89d1eeb7342c 100644 --- a/image/decoders/icon/android/Makefile.in +++ b/image/decoders/icon/android/Makefile.in @@ -13,9 +13,6 @@ LIBRARY_NAME = imgiconandroid_s LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/image/decoders/icon/gtk/Makefile.in b/image/decoders/icon/gtk/Makefile.in index 7456c6c95eb7..4f7f51b91a36 100644 --- a/image/decoders/icon/gtk/Makefile.in +++ b/image/decoders/icon/gtk/Makefile.in @@ -19,8 +19,5 @@ else LOCAL_INCLUDES += $(TK_CFLAGS) endif -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/image/decoders/icon/mac/Makefile.in b/image/decoders/icon/mac/Makefile.in index 3c8948c013ed..9eaddda84d76 100644 --- a/image/decoders/icon/mac/Makefile.in +++ b/image/decoders/icon/mac/Makefile.in @@ -14,7 +14,4 @@ FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/image/decoders/icon/os2/Makefile.in b/image/decoders/icon/os2/Makefile.in index 79f28f22d0dc..091686b75ba4 100644 --- a/image/decoders/icon/os2/Makefile.in +++ b/image/decoders/icon/os2/Makefile.in @@ -12,8 +12,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/image/decoders/icon/qt/Makefile.in b/image/decoders/icon/qt/Makefile.in index 20ddb8fc5730..282c6d1eb7be 100644 --- a/image/decoders/icon/qt/Makefile.in +++ b/image/decoders/icon/qt/Makefile.in @@ -14,9 +14,6 @@ LIBXUL_LIBRARY = 1 LOCAL_INCLUDES += $(MOZ_QT_CFLAGS) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - EXTRA_COMPONENTS = gtkqticonsconverter.manifest include $(topsrcdir)/config/rules.mk diff --git a/image/decoders/icon/win/Makefile.in b/image/decoders/icon/win/Makefile.in index b491b566bea5..8dc0a33fdd0f 100644 --- a/image/decoders/icon/win/Makefile.in +++ b/image/decoders/icon/win/Makefile.in @@ -13,8 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/image/encoders/bmp/Makefile.in b/image/encoders/bmp/Makefile.in index 781bc2063671..0416c5b51943 100644 --- a/image/encoders/bmp/Makefile.in +++ b/image/encoders/bmp/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/encoders/ico/Makefile.in b/image/encoders/ico/Makefile.in index 091673b120c8..88c17df739f7 100644 --- a/image/encoders/ico/Makefile.in +++ b/image/encoders/ico/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/encoders/jpeg/Makefile.in b/image/encoders/jpeg/Makefile.in index c6e9a4396a73..93592f5c0223 100644 --- a/image/encoders/jpeg/Makefile.in +++ b/image/encoders/jpeg/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/encoders/png/Makefile.in b/image/encoders/png/Makefile.in index 5dd4b60b8636..2797257edcf7 100644 --- a/image/encoders/png/Makefile.in +++ b/image/encoders/png/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/image/src/Makefile.in b/image/src/Makefile.in index 56b61d300a91..aa9ff826a953 100644 --- a/image/src/Makefile.in +++ b/image/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = imglib2_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/intl/locale/src/Makefile.in b/intl/locale/src/Makefile.in index 7840263c1d8f..34d548b5e122 100644 --- a/intl/locale/src/Makefile.in +++ b/intl/locale/src/Makefile.in @@ -22,8 +22,6 @@ EXPORT_RESOURCE = \ $(srcdir)/language.properties \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 LOCAL_INCLUDES = \ -I$(topsrcdir)/intl/uconv/src \ diff --git a/intl/locale/src/mac/Makefile.in b/intl/locale/src/mac/Makefile.in index 2a06e0e1e955..40133bb53267 100644 --- a/intl/locale/src/mac/Makefile.in +++ b/intl/locale/src/mac/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/locale/src/os2/Makefile.in b/intl/locale/src/os2/Makefile.in index be245b34940c..40e7f3a1cfcb 100644 --- a/intl/locale/src/os2/Makefile.in +++ b/intl/locale/src/os2/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk EXPORT_LIBRARY = 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/locale/src/unix/Makefile.in b/intl/locale/src/unix/Makefile.in index 2e1d2bacaf66..02eec2debe50 100644 --- a/intl/locale/src/unix/Makefile.in +++ b/intl/locale/src/unix/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB= 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/intl/locale/src/windows/Makefile.in b/intl/locale/src/windows/Makefile.in index 943cde4d7cd4..491834017aef 100644 --- a/intl/locale/src/windows/Makefile.in +++ b/intl/locale/src/windows/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/lwbrk/src/Makefile.in b/intl/lwbrk/src/Makefile.in index 65b10a1a70c1..bc3186681768 100644 --- a/intl/lwbrk/src/Makefile.in +++ b/intl/lwbrk/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/strres/src/Makefile.in b/intl/strres/src/Makefile.in index b9b1d0d23875..0b356512efac 100644 --- a/intl/strres/src/Makefile.in +++ b/intl/strres/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvcn/Makefile.in b/intl/uconv/ucvcn/Makefile.in index f333555fe9b0..cc8665fc944d 100644 --- a/intl/uconv/ucvcn/Makefile.in +++ b/intl/uconv/ucvcn/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB=1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvibm/Makefile.in b/intl/uconv/ucvibm/Makefile.in index 5e5d3a0eb92e..f20937b5c24a 100644 --- a/intl/uconv/ucvibm/Makefile.in +++ b/intl/uconv/ucvibm/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES = -I$(srcdir)/../util diff --git a/intl/uconv/ucvja/Makefile.in b/intl/uconv/ucvja/Makefile.in index c933518ab12d..dc902b449215 100644 --- a/intl/uconv/ucvja/Makefile.in +++ b/intl/uconv/ucvja/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvko/Makefile.in b/intl/uconv/ucvko/Makefile.in index 31511463b152..23bf9407313b 100644 --- a/intl/uconv/ucvko/Makefile.in +++ b/intl/uconv/ucvko/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB=1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvlatin/Makefile.in b/intl/uconv/ucvlatin/Makefile.in index f9e298133ca5..81344835860b 100644 --- a/intl/uconv/ucvlatin/Makefile.in +++ b/intl/uconv/ucvlatin/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvtw/Makefile.in b/intl/uconv/ucvtw/Makefile.in index f333555fe9b0..cc8665fc944d 100644 --- a/intl/uconv/ucvtw/Makefile.in +++ b/intl/uconv/ucvtw/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB=1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/ucvtw2/Makefile.in b/intl/uconv/ucvtw2/Makefile.in index 2ed65784960c..dc902b449215 100644 --- a/intl/uconv/ucvtw2/Makefile.in +++ b/intl/uconv/ucvtw2/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB=1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/util/Makefile.in b/intl/uconv/util/Makefile.in index edfa1fb6111d..14ad5ad0211f 100644 --- a/intl/uconv/util/Makefile.in +++ b/intl/uconv/util/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 CSRCS = \ diff --git a/intl/unicharutil/src/Makefile.in b/intl/unicharutil/src/Makefile.in index 9666019f3f57..104378a1773a 100644 --- a/intl/unicharutil/src/Makefile.in +++ b/intl/unicharutil/src/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/ipc/app/plugin-container.exe.manifest b/ipc/app/plugin-container.exe.manifest index 6932a0054ae7..3533dda6b7a3 100644 --- a/ipc/app/plugin-container.exe.manifest +++ b/ipc/app/plugin-container.exe.manifest @@ -33,7 +33,10 @@ - + + + + diff --git a/ipc/chromium/Makefile.in b/ipc/chromium/Makefile.in index 04307a804501..33af2a670a0a 100644 --- a/ipc/chromium/Makefile.in +++ b/ipc/chromium/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk OS_CXXFLAGS := $(filter-out -fshort-wchar,$(OS_CXXFLAGS)) LIBRARY_NAME = chromium_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/dbus/Makefile.in b/ipc/dbus/Makefile.in index 60d72176c230..7a50377d2e69 100644 --- a/ipc/dbus/Makefile.in +++ b/ipc/dbus/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozdbus_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/glue/Makefile.in b/ipc/glue/Makefile.in index bfec1ef4ccd8..6e34856d622d 100644 --- a/ipc/glue/Makefile.in +++ b/ipc/glue/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter LIBRARY_NAME = mozipc_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/ipdl/Makefile.in b/ipc/ipdl/Makefile.in index 88c2c8e8e031..3d0dc862fa7c 100644 --- a/ipc/ipdl/Makefile.in +++ b/ipc/ipdl/Makefile.in @@ -13,7 +13,6 @@ GARBAGE_DIRS += _ipdlheaders GARBAGE += ipdl_lextab.py ipdl_yacctab.py $(wildcard *.pyc $(srcdir)/ipdl/*.pyc $(srcdir)/ipdl/cxx/*.pyc) LIBRARY_NAME = mozipdlgen_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/ipdl/test/cxx/Makefile.in b/ipc/ipdl/test/cxx/Makefile.in index e207fcb59a0f..d638de7c74bd 100644 --- a/ipc/ipdl/test/cxx/Makefile.in +++ b/ipc/ipdl/test/cxx/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = $(MODULE)_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 IPDLTESTS = \ diff --git a/ipc/netd/Makefile.in b/ipc/netd/Makefile.in index 7c90dd9782a0..6c131b580baf 100644 --- a/ipc/netd/Makefile.in +++ b/ipc/netd/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = moznetd_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/nfc/Makefile.in b/ipc/nfc/Makefile.in index 86fb1b77e84b..030939584a97 100644 --- a/ipc/nfc/Makefile.in +++ b/ipc/nfc/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = moznfc_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/ril/Makefile.in b/ipc/ril/Makefile.in index cc3792182f4b..08a9aa992174 100644 --- a/ipc/ril/Makefile.in +++ b/ipc/ril/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozril_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/testshell/Makefile.in b/ipc/testshell/Makefile.in index 960615db84fa..84d38bddceed 100644 --- a/ipc/testshell/Makefile.in +++ b/ipc/testshell/Makefile.in @@ -12,7 +12,6 @@ FAIL_ON_WARNINGS = 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = ipcshell_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/ipc/unixsocket/Makefile.in b/ipc/unixsocket/Makefile.in index 8ff84f39ca8d..3f1ef516ccaa 100644 --- a/ipc/unixsocket/Makefile.in +++ b/ipc/unixsocket/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozipcunixsocket_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/js/ipc/Makefile.in b/js/ipc/Makefile.in index f525f3126648..d134e6f58148 100644 --- a/js/ipc/Makefile.in +++ b/js/ipc/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsipc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/js/src/assembler/assembler/AssemblerBuffer.h b/js/src/assembler/assembler/AssemblerBuffer.h index 0e0f8c0070bf..1f1119746b7e 100644 --- a/js/src/assembler/assembler/AssemblerBuffer.h +++ b/js/src/assembler/assembler/AssemblerBuffer.h @@ -64,9 +64,6 @@ namespace JSC { , m_capacity(inlineCapacity) , m_size(0) , m_oom(false) -#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE) - , m_skipInline(js::TlsPerThreadData.get(), &m_inlineBuffer) -#endif { } @@ -250,17 +247,6 @@ namespace JSC { int m_capacity; int m_size; bool m_oom; - -#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE) - /* - * GC Pointers baked into the code can get stored on the stack here - * through the inline assembler buffer. We need to protect these from - * being poisoned by the rooting analysis, however, they do not need to - * actually be traced: the compiler is only allowed to bake in - * non-nursery-allocated pointers, such as Shapes. - */ - js::SkipRoot m_skipInline; -#endif }; class GenericAssembler diff --git a/js/src/build/autoconf/android.m4 b/js/src/build/autoconf/android.m4 index fa31afbf42bf..9fea2a9aba07 100644 --- a/js/src/build/autoconf/android.m4 +++ b/js/src/build/autoconf/android.m4 @@ -69,7 +69,7 @@ case "$target" in kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"` - for version in $android_gnu_compiler_version 4.6 4.4.3 ; do + for version in $android_gnu_compiler_version 4.7 4.6 4.4.3 ; do case "$target_cpu" in arm) target_name=arm-linux-androideabi-$version diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index ce22a3b40f1d..87970ec2acf6 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -427,7 +427,7 @@ static bool intl_availableLocales(JSContext *cx, CountAvailable countAvailable, GetAvailable getAvailable, MutableHandleValue result) { - RootedObject locales(cx, NewObjectWithGivenProto(cx, &ObjectClass, NULL, NULL)); + RootedObject locales(cx, NewObjectWithGivenProto(cx, &JSObject::class_, NULL, NULL)); if (!locales) return false; diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index a40a5b23e028..07f20e872670 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -15,7 +15,6 @@ #include "vm/StringBuffer.h" #include "jsobjinlines.h" -#include "jsstrinlines.h" using namespace js; using namespace js::types; @@ -366,7 +365,7 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp) if (!ValueToId(cx, args.handleAt(0), &id)) return false; - RootedObject descObj(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject descObj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!descObj) return false; @@ -421,7 +420,7 @@ obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp) RootedObject obj(cx, ToObject(cx, args.thisv())); if (!obj) return JS_FALSE; - if (obj->isProxy()) { + if (obj->is()) { // The vanilla getter lookup code below requires that the object is // native. Handle proxies separately. args.rval().setUndefined(); @@ -457,7 +456,7 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp) RootedObject obj(cx, ToObject(cx, args.thisv())); if (!obj) return JS_FALSE; - if (obj->isProxy()) { + if (obj->is()) { // The vanilla setter lookup code below requires that the object is // native. Handle proxies separately. args.rval().setUndefined(); @@ -613,7 +612,7 @@ obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) if (args.thisv().isObject() && ValueToId(cx, idValue, &id)) { JSObject *obj = &args.thisv().toObject(), *obj2; Shape *prop; - if (!obj->isProxy() && + if (!obj->is() && HasOwnProperty(cx, obj->getOps()->lookupGeneric, obj, id, &obj2, &prop)) { args.rval().setBoolean(!!prop); @@ -634,7 +633,7 @@ obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) /* Non-standard code for proxies. */ RootedObject obj2(cx); RootedShape prop(cx); - if (obj->isProxy()) { + if (obj->is()) { bool has; if (!Proxy::hasOwn(cx, obj, idRoot, &has)) return false; @@ -703,7 +702,7 @@ obj_create(JSContext *cx, unsigned argc, Value *vp) * Use the callee's global as the parent of the new object to avoid dynamic * scoping (i.e., using the caller's global). */ - RootedObject obj(cx, NewObjectWithGivenProto(cx, &ObjectClass, proto, &args.callee().global())); + RootedObject obj(cx, NewObjectWithGivenProto(cx, &JSObject::class_, proto, &args.callee().global())); if (!obj) return false; diff --git a/js/src/builtin/ParallelArray.cpp b/js/src/builtin/ParallelArray.cpp index dc0eaa9c6268..d5923e1fc1a1 100644 --- a/js/src/builtin/ParallelArray.cpp +++ b/js/src/builtin/ParallelArray.cpp @@ -12,7 +12,6 @@ #include "vm/GlobalObject.h" #include "vm/String.h" -#include "jsgcinlines.h" #include "jsobjinlines.h" using namespace js; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 5d471f97d1d9..ff1b9ac38495 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -331,7 +331,7 @@ IsProxy(JSContext *cx, unsigned argc, jsval *vp) args.rval().setBoolean(false); return true; } - args.rval().setBoolean(args[0].toObject().isProxy()); + args.rval().setBoolean(args[0].toObject().is()); return true; } diff --git a/js/src/config/config.mk b/js/src/config/config.mk index 389b8077809e..e2fa07f47ad1 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -116,10 +116,6 @@ endif OS_CONFIG := $(OS_ARCH)$(OS_RELEASE) -FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs -FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps -FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names - MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX) MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX) @@ -328,14 +324,7 @@ endif # building libxul libraries ifdef LIBXUL_LIBRARY DEFINES += \ - -D_IMPL_NS_COM \ - -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ - -D_IMPL_NS_GFX \ - -D_IMPL_NS_WIDGET \ - -DIMPL_XREAPI \ - -DIMPL_NS_NET \ - -DIMPL_THEBES \ + -DIMPL_LIBXUL \ $(NULL) ifndef JS_SHARED_LIBRARY @@ -813,3 +802,11 @@ MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS) endif DEFINES += -DNO_NSPR_10_SUPPORT + +# Run a named Python build action. The first argument is the name of the build +# action. The second argument are the arguments to pass to the action (space +# delimited arguments). e.g. +# +# libs:: +# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest) +py_action = $(PYTHON) -m mozbuild.action.$(1) $(2) diff --git a/js/src/config/makefiles/target_export.mk b/js/src/config/makefiles/target_export.mk index 7aa530bfe99f..d626af8674a9 100644 --- a/js/src/config/makefiles/target_export.mk +++ b/js/src/config/makefiles/target_export.mk @@ -30,18 +30,3 @@ export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(LOOP_OVER_DIRS) $(LOOP_OVER_TOOL_DIRS) - -# -# Rule to create list of libraries for final link -# -# todo: use pre-req deps rather than conditionals -export:: export-gen-final-lib-link-list -export-gen-final-lib-link-list: -ifdef LIBRARY_NAME #{ -ifdef EXPORT_LIBRARY #{ -ifdef IS_COMPONENT #{ -else # !IS_COMPONENT - $(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME) -endif #} IS_COMPONENT -endif #} EXPORT_LIBRARY -endif #} LIBRARY_NAME diff --git a/js/src/config/makefiles/xpcshell.mk b/js/src/config/makefiles/xpcshell.mk index 0af8caff7571..0a49e2c1c9de 100644 --- a/js/src/config/makefiles/xpcshell.mk +++ b/js/src/config/makefiles/xpcshell.mk @@ -29,9 +29,7 @@ libs:: libs-xpcshell-tests libs-xpcshell-tests: $(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS)) ifndef NO_XPCSHELL_MANIFEST_CHECK #{ - $(PYTHON) $(MOZILLA_DIR)/build/xpccheck.py \ - $(topsrcdir) \ - $(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS)) + $(call py_action,xpccheck,$(topsrcdir) $(addprefix $(MOZILLA_DIR)/$(relativesrcdir)/,$(XPCSHELL_TESTS))) endif #} NO_XPCSHELL_MANIFEST_CHECK ########################################################################### diff --git a/js/src/configure.in b/js/src/configure.in index 9d1a8a76a83b..73b46dbd0a90 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1146,6 +1146,27 @@ if test "$GNU_CC"; then DSO_CFLAGS='' DSO_PIC_CFLAGS='-fPIC' ASFLAGS="$ASFLAGS -fPIC" + AC_MSG_CHECKING([for --noexecstack option to as]) + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Wa,--noexecstack" + AC_TRY_COMPILE(,,AC_MSG_RESULT([yes]) + [ASFLAGS="$ASFLAGS -Wa,--noexecstack"], + AC_MSG_RESULT([no])) + CFLAGS=$_SAVE_CFLAGS + AC_MSG_CHECKING([for -z noexecstack option to ld]) + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" + AC_TRY_LINK(,,AC_MSG_RESULT([yes]), + AC_MSG_RESULT([no]) + LDFLAGS=$_SAVE_LDFLAGS) + + AC_MSG_CHECKING([for -z text option to ld]) + _SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-z,text" + AC_TRY_LINK(,,AC_MSG_RESULT([yes]) + [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"], + AC_MSG_RESULT([no]) + LDFLAGS=$_SAVE_LDFLAGS) AC_MSG_CHECKING([for --build-id option to ld]) _SAVE_LDFLAGS=$LDFLAGS @@ -1719,7 +1740,6 @@ ia64*-hpux*) AC_DEFINE(XP_WIN32) AC_DEFINE(HW_THREADS) AC_DEFINE(STDC_HEADERS) - AC_DEFINE(NEW_H, ) AC_DEFINE(WIN32_LEAN_AND_MEAN) TARGET_MD_ARCH=win32 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows' @@ -2520,14 +2540,6 @@ dnl Quota support MOZ_CHECK_HEADERS(sys/quota.h) MOZ_CHECK_HEADERS(linux/quota.h) -dnl Check whether the compiler supports the new-style C++ standard -dnl library headers (i.e. ) or needs the old "new.h" -AC_LANG_CPLUSPLUS -NEW_H=new.h -MOZ_CHECK_HEADER(new, [NEW_H=new]) -AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>) -AC_LANG_C - AC_ARG_ENABLE(dtrace, [ --enable-dtrace build with dtrace support if available (default=no)], [enable_dtrace="yes"],) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 09b0a79a6818..dd84e78ba0ed 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -3534,7 +3534,7 @@ ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHand JS_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST)); gc::AllocKind kind = GuessObjectGCKind(pn_count); - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass, kind, MaybeSingletonObject)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, kind, MaybeSingletonObject)); if (!obj) return false; @@ -5394,7 +5394,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) RootedObject obj(cx); if (bce->script->compileAndGo) { gc::AllocKind kind = GuessObjectGCKind(pn->pn_count); - obj = NewBuiltinClassInstance(cx, &ObjectClass, kind); + obj = NewBuiltinClassInstance(cx, &JSObject::class_, kind); if (!obj) return false; } diff --git a/js/src/gc/Barrier-inl.h b/js/src/gc/Barrier-inl.h index dadaa52799b6..092d6e8b2521 100644 --- a/js/src/gc/Barrier-inl.h +++ b/js/src/gc/Barrier-inl.h @@ -37,7 +37,7 @@ RelocatablePtr::post() { #ifdef JSGC_GENERATIONAL JS_ASSERT(this->value); - this->value->runtime()->gcStoreBuffer.putRelocatableCell((gc::Cell **)&this->value); + T::writeBarrierPostRelocate(this->value, &this->value); #endif } @@ -46,7 +46,7 @@ inline void RelocatablePtr::relocate(JSRuntime *rt) { #ifdef JSGC_GENERATIONAL - rt->gcStoreBuffer.removeRelocatableCell((gc::Cell **)&this->value); + T::writeBarrierPostRemove(this->value, &this->value); #endif } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index ab88346d78b9..b3dfa3d5aa3c 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -13,14 +13,13 @@ #include "gc/GCInternals.h" #include "gc/Memory.h" +#include "vm/ArrayObject.h" #include "vm/Debugger.h" #include "vm/TypedArrayObject.h" -#include "jscompartmentinlines.h" -#include "jsobjinlines.h" - #include "gc/Barrier-inl.h" #include "gc/Nursery-inl.h" +#include "vm/ObjectImpl-inl.h" using namespace js; using namespace gc; diff --git a/js/src/ion/AsmJSLink.cpp b/js/src/ion/AsmJSLink.cpp index cc8c948ed3f6..b55269e5aae1 100644 --- a/js/src/ion/AsmJSLink.cpp +++ b/js/src/ion/AsmJSLink.cpp @@ -573,7 +573,7 @@ js::LinkAsmJS(JSContext *cx, unsigned argc, JS::Value *vp) } gc::AllocKind allocKind = gc::GetGCObjectKind(module.numExportedFunctions()); - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass, allocKind)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind)); if (!obj) return false; diff --git a/js/src/ion/Bailouts.cpp b/js/src/ion/Bailouts.cpp index f8ff65274641..afd5e186b61b 100644 --- a/js/src/ion/Bailouts.cpp +++ b/js/src/ion/Bailouts.cpp @@ -17,8 +17,6 @@ #include "vm/Interpreter.h" #include "ion/BaselineJIT.h" -#include "jsinferinlines.h" - #include "ion/IonFrames-inl.h" #include "vm/Stack-inl.h" diff --git a/js/src/ion/BaselineBailouts.cpp b/js/src/ion/BaselineBailouts.cpp index 5fb068fd074a..cc523f2d5368 100644 --- a/js/src/ion/BaselineBailouts.cpp +++ b/js/src/ion/BaselineBailouts.cpp @@ -14,7 +14,6 @@ #include "vm/Stack-inl.h" #include "jsfuninlines.h" -#include "jsopcodeinlines.h" using namespace js; using namespace js::ion; diff --git a/js/src/ion/BaselineCompiler.cpp b/js/src/ion/BaselineCompiler.cpp index 05ae96cbb536..97970b6755fd 100644 --- a/js/src/ion/BaselineCompiler.cpp +++ b/js/src/ion/BaselineCompiler.cpp @@ -14,8 +14,6 @@ #include "ion/VMFunctions.h" #include "ion/IonFrames-inl.h" -#include "jsopcodeinlines.h" - #include "vm/Interpreter-inl.h" using namespace js; @@ -1413,7 +1411,7 @@ BaselineCompiler::emit_JSOP_NEWINIT() JS_ASSERT(key == JSProto_Object); RootedObject templateObject(cx); - templateObject = NewBuiltinClassInstance(cx, &ObjectClass, TenuredObject); + templateObject = NewBuiltinClassInstance(cx, &JSObject::class_, TenuredObject); if (!templateObject) return false; diff --git a/js/src/ion/BaselineFrameInfo.cpp b/js/src/ion/BaselineFrameInfo.cpp index 8ad1f66759f3..4f47f241c931 100644 --- a/js/src/ion/BaselineFrameInfo.cpp +++ b/js/src/ion/BaselineFrameInfo.cpp @@ -9,7 +9,6 @@ #include "ion/shared/BaselineCompiler-shared.h" #include "jsanalyze.h" -#include "jsinferinlines.h" #include "vm/Shape-inl.h" diff --git a/js/src/ion/BaselineIC.cpp b/js/src/ion/BaselineIC.cpp index 2f4ca165a8c1..3f757348599a 100644 --- a/js/src/ion/BaselineIC.cpp +++ b/js/src/ion/BaselineIC.cpp @@ -3066,10 +3066,10 @@ static void GetFixedOrDynamicSlotOffset(HandleObject obj, uint32_t slot, static bool IsCacheableDOMProxy(JSObject *obj) { - if (!obj->isProxy()) + if (!obj->is()) return false; - BaseProxyHandler *handler = GetProxyHandler(obj); + BaseProxyHandler *handler = obj->as().handler(); if (handler->family() != GetDOMProxyHandlerFamily()) return false; @@ -3101,7 +3101,7 @@ GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, Register object, // 1. The object is a DOMProxy. // 2. The object does not have expando properties, or has an expando // which is known to not have the desired property. - Address handlerAddr(object, JSObject::getFixedSlotOffset(JSSLOT_PROXY_HANDLER)); + Address handlerAddr(object, ProxyObject::offsetOfHandler()); Address expandoAddr(object, JSObject::getFixedSlotOffset(GetDOMProxyExpandoSlot())); // Check that object is a DOMProxy. @@ -5330,8 +5330,9 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, } else { kind = ICStub::GetProp_CallDOMProxyNative; } - ICGetPropCallDOMProxyNativeCompiler compiler(cx, kind, monitorStub, obj, holder, callee, - pc - script->code); + Rooted proxy(cx, &obj->as()); + ICGetPropCallDOMProxyNativeCompiler + compiler(cx, kind, monitorStub, proxy, holder, callee, pc - script->code); newStub = compiler.getStub(compiler.getStubSpace(script)); } else { ICGetProp_CallNative::Compiler compiler(cx, monitorStub, obj, holder, callee, @@ -5350,7 +5351,8 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, JS_ASSERT(obj == holder); IonSpew(IonSpew_BaselineIC, " Generating GetProp(DOMProxyProxy) stub"); - ICGetProp_DOMProxyShadowed::Compiler compiler(cx, monitorStub, obj, name, + Rooted proxy(cx, &obj->as()); + ICGetProp_DOMProxyShadowed::Compiler compiler(cx, monitorStub, proxy, name, pc - script->code); ICStub *newStub = compiler.getStub(compiler.getStubSpace(script)); if (!newStub) @@ -5956,10 +5958,10 @@ ICGetPropCallDOMProxyNativeCompiler::generateStubCode(MacroAssembler &masm) ICStub * ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space) { - RootedShape shape(cx, obj_->lastProperty()); + RootedShape shape(cx, proxy_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - Value expandoSlot = obj_->getFixedSlot(GetDOMProxyExpandoSlot()); + Value expandoSlot = proxy_->getFixedSlot(GetDOMProxyExpandoSlot()); RootedShape expandoShape(cx, NULL); ExpandoAndGeneration *expandoAndGeneration; int32_t generation; @@ -5979,12 +5981,12 @@ ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space) if (kind == ICStub::GetProp_CallDOMProxyNative) { return ICGetProp_CallDOMProxyNative::New( - space, getStubCode(), firstMonitorStub_, shape, GetProxyHandler(obj_), + space, getStubCode(), firstMonitorStub_, shape, proxy_->handler(), expandoShape, holder_, holderShape, getter_, pcOffset_); } return ICGetProp_CallDOMProxyWithGenerationNative::New( - space, getStubCode(), firstMonitorStub_, shape, GetProxyHandler(obj_), + space, getStubCode(), firstMonitorStub_, shape, proxy_->handler(), expandoAndGeneration, generation, expandoShape, holder_, holderShape, getter_, pcOffset_); } @@ -5992,9 +5994,9 @@ ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space) ICStub * ICGetProp_DOMProxyShadowed::Compiler::getStub(ICStubSpace *space) { - RootedShape shape(cx, obj_->lastProperty()); - return ICGetProp_DOMProxyShadowed::New(space, getStubCode(), firstMonitorStub_, - shape, GetProxyHandler(obj_), name_, pcOffset_); + RootedShape shape(cx, proxy_->lastProperty()); + return ICGetProp_DOMProxyShadowed::New(space, getStubCode(), firstMonitorStub_, shape, + proxy_->handler(), name_, pcOffset_); } static bool @@ -6287,7 +6289,7 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub, uint32_t oldSlots = obj->numDynamicSlots(); if (op == JSOP_INITPROP && name != cx->names().proto) { - JS_ASSERT(obj->isObject()); + JS_ASSERT(obj->is()); if (!DefineNativeProperty(cx, obj, id, rhs, NULL, NULL, JSPROP_ENUMERATE, 0, 0, 0)) return false; } else if (op == JSOP_SETNAME || op == JSOP_SETGNAME) { @@ -8557,21 +8559,20 @@ ICGetPropCallDOMProxyNativeStub::ICGetPropCallDOMProxyNativeStub(Kind kind, IonC ICGetPropCallDOMProxyNativeCompiler::ICGetPropCallDOMProxyNativeCompiler(JSContext *cx, ICStub::Kind kind, ICStub *firstMonitorStub, - HandleObject obj, + Handle proxy, HandleObject holder, HandleFunction getter, uint32_t pcOffset) : ICStubCompiler(cx, kind), firstMonitorStub_(firstMonitorStub), - obj_(cx, obj), + proxy_(cx, proxy), holder_(cx, holder), getter_(cx, getter), pcOffset_(pcOffset) { JS_ASSERT(kind == ICStub::GetProp_CallDOMProxyNative || kind == ICStub::GetProp_CallDOMProxyWithGenerationNative); - JS_ASSERT(obj_->isProxy()); - JS_ASSERT(GetProxyHandler(obj_)->family() == GetDOMProxyHandlerFamily()); + JS_ASSERT(proxy_->handler()->family() == GetDOMProxyHandlerFamily()); } ICGetProp_DOMProxyShadowed::ICGetProp_DOMProxyShadowed(IonCode *stubCode, diff --git a/js/src/ion/BaselineIC.h b/js/src/ion/BaselineIC.h index a7ad3c6f1eb2..9e9613108a5a 100644 --- a/js/src/ion/BaselineIC.h +++ b/js/src/ion/BaselineIC.h @@ -4379,7 +4379,7 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN class ICGetPropCallDOMProxyNativeCompiler : public ICStubCompiler { ICStub *firstMonitorStub_; - RootedObject obj_; + Rooted proxy_; RootedObject holder_; RootedFunction getter_; uint32_t pcOffset_; @@ -4390,7 +4390,7 @@ class ICGetPropCallDOMProxyNativeCompiler : public ICStubCompiler { public: ICGetPropCallDOMProxyNativeCompiler(JSContext *cx, ICStub::Kind kind, - ICStub *firstMonitorStub, HandleObject obj, + ICStub *firstMonitorStub, Handle proxy, HandleObject holder, HandleFunction getter, uint32_t pcOffset); @@ -4444,18 +4444,18 @@ class ICGetProp_DOMProxyShadowed : public ICMonitoredStub class Compiler : public ICStubCompiler { ICStub *firstMonitorStub_; - RootedObject obj_; + Rooted proxy_; RootedPropertyName name_; uint32_t pcOffset_; bool generateStubCode(MacroAssembler &masm); public: - Compiler(JSContext *cx, ICStub *firstMonitorStub, HandleObject obj, HandlePropertyName name, - uint32_t pcOffset) + Compiler(JSContext *cx, ICStub *firstMonitorStub, Handle proxy, + HandlePropertyName name, uint32_t pcOffset) : ICStubCompiler(cx, ICStub::GetProp_CallNative), firstMonitorStub_(firstMonitorStub), - obj_(cx, obj), + proxy_(cx, proxy), name_(cx, name), pcOffset_(pcOffset) {} diff --git a/js/src/ion/BitSet.cpp b/js/src/ion/BitSet.cpp index aa2818c209c0..8848876628b1 100644 --- a/js/src/ion/BitSet.cpp +++ b/js/src/ion/BitSet.cpp @@ -7,8 +7,6 @@ #include "jsutil.h" #include "ion/BitSet.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/C1Spewer.cpp b/js/src/ion/C1Spewer.cpp index b8a37d4f958d..6fcb18a03df1 100644 --- a/js/src/ion/C1Spewer.cpp +++ b/js/src/ion/C1Spewer.cpp @@ -16,8 +16,6 @@ #include "ion/LIR.h" #include "ion/LinearScan.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/CodeGenerator.cpp b/js/src/ion/CodeGenerator.cpp index 9a6be755efe5..6abcd7b0565a 100644 --- a/js/src/ion/CodeGenerator.cpp +++ b/js/src/ion/CodeGenerator.cpp @@ -1817,7 +1817,9 @@ CodeGenerator::visitCallKnown(LCallKnown *call) // Invoke in sequential mode, else mark as cannot compile. JS_ASSERT(call->mir()->hasRootedScript()); JSScript *targetScript = target->nonLazyScript(); - if (GetIonScript(targetScript, executionMode) == ION_DISABLED_SCRIPT) { + if (GetIonScript(targetScript, executionMode) == ION_DISABLED_SCRIPT && + (executionMode == ParallelExecution || !targetScript->canBaselineCompile())) + { if (executionMode == ParallelExecution) return false; @@ -2898,7 +2900,7 @@ CodeGenerator::visitNewObjectVMCall(LNewObject *lir) // If we're making a new object with a class prototype (that is, an object // that derives its class from its prototype instead of being - // ObjectClass'd) from self-hosted code, we need a different init + // JSObject::class_'d) from self-hosted code, we need a different init // function. if (lir->mir()->templateObjectIsClassPrototype()) { if (!callVM(NewInitObjectWithClassPrototypeInfo, lir)) diff --git a/js/src/ion/IonBuilder.cpp b/js/src/ion/IonBuilder.cpp index e5bb7588e891..65511393c77a 100644 --- a/js/src/ion/IonBuilder.cpp +++ b/js/src/ion/IonBuilder.cpp @@ -19,7 +19,6 @@ #include "ion/Lowering.h" #include "ion/MIRGraph.h" -#include "jsanalyzeinlines.h" #include "jsscriptinlines.h" #include "ion/CompileInfo-inl.h" @@ -3614,6 +3613,10 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo) // Heuristics! JSScript *targetScript = target->nonLazyScript(); + // Skip heuristics if we have an explicit hint to inline. + if (targetScript->shouldInline) + return true; + // Cap the inlining depth. if (IsSmallFunction(targetScript)) { if (inliningDepth_ >= js_IonOptions.smallFunctionMaxInlineDepth) { @@ -4447,7 +4450,7 @@ IonBuilder::createThisScriptedSingleton(HandleFunction target, MDefinition *call // Generate an inline path to create a new |this| object with // the given singleton prototype. - types::TypeObject *type = cx->getNewType(&ObjectClass, proto.get(), target); + types::TypeObject *type = cx->getNewType(&JSObject::class_, proto.get(), target); if (!type) return NULL; if (!types::TypeScript::ThisTypes(target->nonLazyScript())->hasType(types::Type::ObjectType(type))) @@ -5239,7 +5242,7 @@ IonBuilder::jsop_newobject(HandleObject baseObj) templateObject = CopyInitializerObject(cx, baseObj, newKind); } else { gc::AllocKind allocKind = GuessObjectGCKind(0); - templateObject = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind); + templateObject = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind); } if (!templateObject) @@ -6483,6 +6486,19 @@ MDefinition * IonBuilder::convertShiftToMaskForStaticTypedArray(MDefinition *id, ArrayBufferView::ViewType viewType) { + // No shifting is necessary if the typed array has single byte elements. + if (TypedArrayShift(viewType) == 0) + return id; + + // If the index is an already shifted constant, undo the shift to get the + // absolute offset being accessed. + if (id->isConstant() && id->toConstant()->value().isInt32()) { + int32_t index = id->toConstant()->value().toInt32(); + MConstant *offset = MConstant::New(Int32Value(index << TypedArrayShift(viewType))); + current->add(offset); + return offset; + } + if (!id->isRsh() || id->isEffectful()) return NULL; if (!id->getOperand(1)->isConstant()) @@ -6526,6 +6542,10 @@ IonBuilder::jsop_getelem_typed_static(bool *psucceeded) ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr); + // LoadTypedArrayElementStatic currently treats uint32 arrays as int32. + if (viewType == ArrayBufferView::TYPE_UINT32) + return true; + MDefinition *ptr = convertShiftToMaskForStaticTypedArray(id, viewType); if (!ptr) return true; diff --git a/js/src/ion/IonCaches.cpp b/js/src/ion/IonCaches.cpp index 07c83f78bbd1..c1397f7fe7a2 100644 --- a/js/src/ion/IonCaches.cpp +++ b/js/src/ion/IonCaches.cpp @@ -424,10 +424,10 @@ IonCache::initializeAddCacheState(LInstruction *ins, AddCacheState *addState) static bool IsCacheableDOMProxy(JSObject *obj) { - if (!obj->isProxy()) + if (!obj->is()) return false; - BaseProxyHandler *handler = GetProxyHandler(obj); + BaseProxyHandler *handler = obj->as().handler(); if (handler->family() != GetDOMProxyHandlerFamily()) return false; @@ -637,11 +637,12 @@ GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj, // 1. The object is a DOMProxy. // 2. The object does not have expando properties, or has an expando // which is known to not have the desired property. - Address handlerAddr(object, JSObject::getFixedSlotOffset(JSSLOT_PROXY_HANDLER)); + Address handlerAddr(object, ProxyObject::offsetOfHandler()); Address expandoSlotAddr(object, JSObject::getFixedSlotOffset(GetDOMProxyExpandoSlot())); // Check that object is a DOMProxy. - masm.branchPrivatePtr(Assembler::NotEqual, handlerAddr, ImmWord(GetProxyHandler(obj)), stubFailure); + masm.branchPrivatePtr(Assembler::NotEqual, handlerAddr, + ImmWord(obj->as().handler()), stubFailure); if (skipExpandoCheck) return; @@ -1348,7 +1349,7 @@ DetermineGetPropKind(JSContext *cx, IonCache &cache, JSObject *receiver, { // With Proxies, we cannot garantee any property access as the proxy can // mask any property from the prototype chain. - JS_ASSERT(!checkObj->isProxy()); + JS_ASSERT(!checkObj->is()); *readSlot = true; } else if (IsCacheableGetPropCallNative(checkObj, holder, shape) || IsCacheableGetPropCallPropertyOp(checkObj, holder, shape)) diff --git a/js/src/ion/IonFrames.cpp b/js/src/ion/IonFrames.cpp index 5e2a30b79daa..e19877a5bbd5 100644 --- a/js/src/ion/IonFrames.cpp +++ b/js/src/ion/IonFrames.cpp @@ -1049,6 +1049,15 @@ GetPcScript(JSContext *cx, JSScript **scriptRes, jsbytecode **pcRes) // Recover the return address. IonFrameIterator it(rt->mainThread.ionTop); + // If the previous frame is a rectifier frame (maybe unwound), + // skip past it. + if (it.prevType() == IonFrame_Rectifier || it.prevType() == IonFrame_Unwound_Rectifier) { + ++it; + JS_ASSERT(it.prevType() == IonFrame_BaselineStub || + it.prevType() == IonFrame_BaselineJS || + it.prevType() == IonFrame_OptimizedJS); + } + // If the previous frame is a stub frame, skip the exit frame so that // returnAddress below gets the return address into the BaselineJS // frame. diff --git a/js/src/ion/IonMacroAssembler.h b/js/src/ion/IonMacroAssembler.h index f6024c7eb8e3..3a1ac52b72c8 100644 --- a/js/src/ion/IonMacroAssembler.h +++ b/js/src/ion/IonMacroAssembler.h @@ -24,6 +24,7 @@ #include "ion/ParallelFunctions.h" #include "ion/VMFunctions.h" #include "vm/ForkJoin.h" +#include "vm/ProxyObject.h" #include "vm/Shape.h" #include "vm/TypedArrayObject.h" @@ -753,9 +754,9 @@ class MacroAssembler : public MacroAssemblerSpecific // of the JSObject::isWrapper test performed in EmulatesUndefined. If none // of the branches are taken, we can check class flags directly. loadObjClass(objReg, scratch); - branchPtr(Assembler::Equal, scratch, ImmWord(&ObjectProxyClass), slowCheck); - branchPtr(Assembler::Equal, scratch, ImmWord(&OuterWindowProxyClass), slowCheck); - branchPtr(Assembler::Equal, scratch, ImmWord(&FunctionProxyClass), slowCheck); + branchPtr(Assembler::Equal, scratch, ImmWord(&ObjectProxyObject::class_), slowCheck); + branchPtr(Assembler::Equal, scratch, ImmWord(&OuterWindowProxyObject::class_), slowCheck); + branchPtr(Assembler::Equal, scratch, ImmWord(&FunctionProxyObject::class_), slowCheck); test32(Address(scratch, Class::offsetOfFlags()), Imm32(JSCLASS_EMULATES_UNDEFINED)); return truthy ? Assembler::Zero : Assembler::NonZero; diff --git a/js/src/ion/IonSpewer.cpp b/js/src/ion/IonSpewer.cpp index 979d0b1b26c0..cfe35f65c268 100644 --- a/js/src/ion/IonSpewer.cpp +++ b/js/src/ion/IonSpewer.cpp @@ -9,8 +9,6 @@ #include "ion/Ion.h" #include "ion/IonSpewer.h" -#include "jsscriptinlines.h" - #ifndef ION_SPEW_DIR # if defined(_WIN32) # define ION_SPEW_DIR "" diff --git a/js/src/ion/LIR-Common.h b/js/src/ion/LIR-Common.h index 7df8079a5ace..238740dd4619 100644 --- a/js/src/ion/LIR-Common.h +++ b/js/src/ion/LIR-Common.h @@ -226,13 +226,13 @@ class LControlInstructionHelper : public LInstructionHelper<0, Operands, Temps> MBasicBlock *successors_[Succs]; public: - size_t numSuccessors() const MOZ_FINAL MOZ_OVERRIDE { return Succs; } + virtual size_t numSuccessors() const MOZ_FINAL MOZ_OVERRIDE { return Succs; } - MBasicBlock *getSuccessor(size_t i) const MOZ_FINAL MOZ_OVERRIDE { + virtual MBasicBlock *getSuccessor(size_t i) const MOZ_FINAL MOZ_OVERRIDE { return successors_[i]; } - void setSuccessor(size_t i, MBasicBlock *successor) MOZ_FINAL MOZ_OVERRIDE { + virtual void setSuccessor(size_t i, MBasicBlock *successor) MOZ_FINAL MOZ_OVERRIDE { successors_[i] = successor; } }; diff --git a/js/src/ion/Lowering.cpp b/js/src/ion/Lowering.cpp index 0e042f9ca213..311b806f75a4 100644 --- a/js/src/ion/Lowering.cpp +++ b/js/src/ion/Lowering.cpp @@ -1226,11 +1226,7 @@ LIRGenerator::visitMul(MMul *ins) JS_ASSERT(lhs->type() == MIRType_Double); ReorderCommutative(&lhs, &rhs); - // If our LHS is a constant -1.0, we can optimize to an LNegD. - if (lhs->isConstant() && lhs->toConstant()->value() == DoubleValue(-1.0)) - return defineReuseInput(new LNegD(useRegisterAtStart(rhs)), ins, 0); - - // We can do the same for the RHS, if we just swap the operands. + // If our RHS is a constant -1.0, we can optimize to an LNegD. if (rhs->isConstant() && rhs->toConstant()->value() == DoubleValue(-1.0)) return defineReuseInput(new LNegD(useRegisterAtStart(lhs)), ins, 0); diff --git a/js/src/ion/MIR.cpp b/js/src/ion/MIR.cpp index 73bf18563f89..beb502e14666 100644 --- a/js/src/ion/MIR.cpp +++ b/js/src/ion/MIR.cpp @@ -1545,6 +1545,26 @@ MustBeUInt32(MDefinition *def, MDefinition **pwrapped) return false; } +bool +MBinaryInstruction::tryUseUnsignedOperands() +{ + MDefinition *newlhs, *newrhs; + if (MustBeUInt32(getOperand(0), &newlhs) && MustBeUInt32(getOperand(1), &newrhs)) { + if (newlhs->type() != MIRType_Int32 || newrhs->type() != MIRType_Int32) + return false; + if (newlhs != getOperand(0)) { + getOperand(0)->setFoldedUnchecked(); + replaceOperand(0, newlhs); + } + if (newrhs != getOperand(1)) { + getOperand(1)->setFoldedUnchecked(); + replaceOperand(1, newrhs); + } + return true; + } + return false; +} + void MCompare::infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc) { @@ -1560,19 +1580,9 @@ MCompare::infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc) bool strictEq = jsop() == JSOP_STRICTEQ || jsop() == JSOP_STRICTNE; bool relationalEq = !(looseEq || strictEq); - // Comparisons on unsigned integers may be treated as UInt32. Skip any (x >>> 0) - // operation coercing the operands to uint32. The type policy will make sure the - // now unwrapped operand is an int32. + // Comparisons on unsigned integers may be treated as UInt32. MDefinition *newlhs, *newrhs; - if (MustBeUInt32(getOperand(0), &newlhs) && MustBeUInt32(getOperand(1), &newrhs)) { - if (newlhs != getOperand(0)) { - getOperand(0)->setFoldedUnchecked(); - replaceOperand(0, newlhs); - } - if (newrhs != getOperand(1)) { - getOperand(1)->setFoldedUnchecked(); - replaceOperand(1, newrhs); - } + if (tryUseUnsignedOperands()) { compareType_ = Compare_UInt32; return; } diff --git a/js/src/ion/MIR.h b/js/src/ion/MIR.h index d3f8b1a72051..3ad2362e2a0e 100644 --- a/js/src/ion/MIR.h +++ b/js/src/ion/MIR.h @@ -1706,6 +1706,11 @@ class MBinaryInstruction : public MAryInstruction<2> return (left->valueNumber() == insLeft->valueNumber()) && (right->valueNumber() == insRight->valueNumber()); } + + // Return true if the operands to this instruction are both unsigned, + // in which case any wrapping operands were replaced with the underlying + // int32 operands. + bool tryUseUnsignedOperands(); }; class MTernaryInstruction : public MAryInstruction<3> @@ -3388,12 +3393,14 @@ class MDiv : public MBinaryArithInstruction bool canBeNegativeZero_; bool canBeNegativeOverflow_; bool canBeDivideByZero_; + bool unsigned_; MDiv(MDefinition *left, MDefinition *right, MIRType type) : MBinaryArithInstruction(left, right), canBeNegativeZero_(true), canBeNegativeOverflow_(true), - canBeDivideByZero_(true) + canBeDivideByZero_(true), + unsigned_(false) { if (type != MIRType_Value) specialization_ = type; @@ -3438,14 +3445,21 @@ class MDiv : public MBinaryArithInstruction return canBeDivideByZero_; } + bool isUnsigned() { + return unsigned_; + } + bool fallible(); bool truncate(); }; class MMod : public MBinaryArithInstruction { + bool unsigned_; + MMod(MDefinition *left, MDefinition *right, MIRType type) - : MBinaryArithInstruction(left, right) + : MBinaryArithInstruction(left, right), + unsigned_(false) { if (type != MIRType_Value) specialization_ = type; @@ -3474,6 +3488,10 @@ class MMod : public MBinaryArithInstruction bool canBeDivideByZero() const; bool canBePowerOfTwoDivisor() const; + bool isUnsigned() { + return unsigned_; + } + bool fallible(); void computeRange(); diff --git a/js/src/ion/MIRGraph.cpp b/js/src/ion/MIRGraph.cpp index 6dcfb3c1b1cf..8724ec1774b4 100644 --- a/js/src/ion/MIRGraph.cpp +++ b/js/src/ion/MIRGraph.cpp @@ -12,7 +12,6 @@ #include "ion/MIRGraph.h" #include "ion/IonBuilder.h" #include "jsinferinlines.h" -#include "jsscriptinlines.h" using namespace js; using namespace js::ion; diff --git a/js/src/ion/MoveResolver.cpp b/js/src/ion/MoveResolver.cpp index a52e1b2843a0..fd9f1400ec77 100644 --- a/js/src/ion/MoveResolver.cpp +++ b/js/src/ion/MoveResolver.cpp @@ -6,8 +6,6 @@ #include "ion/MoveResolver.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/ParallelFunctions.cpp b/js/src/ion/ParallelFunctions.cpp index c2754823cb79..bacde4ae3f71 100644 --- a/js/src/ion/ParallelFunctions.cpp +++ b/js/src/ion/ParallelFunctions.cpp @@ -9,8 +9,6 @@ #include "ion/IonSpewer.h" #include "vm/Interpreter.h" -#include "jscompartmentinlines.h" -#include "jsstrinlines.h" #include "vm/Interpreter-inl.h" using namespace js; diff --git a/js/src/ion/RangeAnalysis.cpp b/js/src/ion/RangeAnalysis.cpp index 98c562f500b3..91c4ddc54640 100644 --- a/js/src/ion/RangeAnalysis.cpp +++ b/js/src/ion/RangeAnalysis.cpp @@ -940,6 +940,10 @@ MMul::computeRange() if (canBeNegativeZero()) canBeNegativeZero_ = Range::negativeZeroMul(&left, &right); setRange(Range::mul(&left, &right)); + + // Truncated multiplications could overflow in both directions + if (isTruncated() && !range()->isInt32()) + setRange(new Range(INT32_MIN, INT32_MAX)); } void @@ -1586,6 +1590,13 @@ MDiv::truncate() // Remember analysis, needed to remove negative zero checks. setTruncated(true); + // Divisions where the lhs and rhs are unsigned and the result is + // truncated can be lowered more efficiently. + if (specialization() == MIRType_Int32 && tryUseUnsignedOperands()) { + unsigned_ = true; + return true; + } + // No modifications. return false; } @@ -1596,6 +1607,12 @@ MMod::truncate() // Remember analysis, needed to remove negative zero checks. setTruncated(true); + // As for division, handle unsigned modulus with a truncated result. + if (specialization() == MIRType_Int32 && tryUseUnsignedOperands()) { + unsigned_ = true; + return true; + } + // No modifications. return false; } @@ -1759,7 +1776,14 @@ RangeAnalysis::truncate() // Set truncated flag if range analysis ensure that it has no // rounding errors and no fractional part. const Range *r = iter->range(); - if (!r || r->hasRoundingErrors()) + bool hasRoundingErrors = !r || r->hasRoundingErrors(); + + // Special case integer division: the result of a/b can be infinite + // but cannot actually have rounding errors induced by truncation. + if (iter->isDiv() && iter->toDiv()->specialization() == MIRType_Int32) + hasRoundingErrors = false; + + if (hasRoundingErrors) continue; // Ensure all observable uses are truncated. diff --git a/js/src/ion/Snapshots.cpp b/js/src/ion/Snapshots.cpp index d235f3efaf20..108dac7eedc4 100644 --- a/js/src/ion/Snapshots.cpp +++ b/js/src/ion/Snapshots.cpp @@ -17,8 +17,6 @@ #include "ion/LIR.h" #endif -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/arm/CodeGenerator-arm.cpp b/js/src/ion/arm/CodeGenerator-arm.cpp index fc70d5cf38f9..febe10fc172d 100644 --- a/js/src/ion/arm/CodeGenerator-arm.cpp +++ b/js/src/ion/arm/CodeGenerator-arm.cpp @@ -1806,7 +1806,7 @@ CodeGeneratorARM::visitAsmJSPassStackArg(LAsmJSPassStackArg *ins) bool -CodeGeneratorARM::visitAsmJSDivOrMod(LAsmJSDivOrMod *ins) +CodeGeneratorARM::visitUDivOrMod(LUDivOrMod *ins) { //Register remainder = ToRegister(ins->remainder()); Register lhs = ToRegister(ins->lhs()); diff --git a/js/src/ion/arm/CodeGenerator-arm.h b/js/src/ion/arm/CodeGenerator-arm.h index ae016c4c90b3..8a9a880a15ec 100644 --- a/js/src/ion/arm/CodeGenerator-arm.h +++ b/js/src/ion/arm/CodeGenerator-arm.h @@ -171,7 +171,7 @@ class CodeGeneratorARM : public CodeGeneratorShared } bool visitEffectiveAddress(LEffectiveAddress *ins); - bool visitAsmJSDivOrMod(LAsmJSDivOrMod *ins); + bool visitUDivOrMod(LUDivOrMod *ins); }; typedef CodeGeneratorARM CodeGeneratorSpecific; diff --git a/js/src/ion/arm/LIR-arm.h b/js/src/ion/arm/LIR-arm.h index 58c2ff4d4c28..73244cb82184 100644 --- a/js/src/ion/arm/LIR-arm.h +++ b/js/src/ion/arm/LIR-arm.h @@ -343,12 +343,12 @@ class LMulI : public LBinaryMath<0> // This class performs a simple x86 'div', yielding either a quotient or remainder depending on // whether this instruction is defined to output eax (quotient) or edx (remainder). -class LAsmJSDivOrMod : public LBinaryMath<2> +class LUDivOrMod : public LBinaryMath<2> { public: - LIR_HEADER(AsmJSDivOrMod); + LIR_HEADER(UDivOrMod); - LAsmJSDivOrMod(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp1, const LDefinition &temp2) { + LUDivOrMod(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp1, const LDefinition &temp2) { setOperand(0, lhs); setOperand(1, rhs); setTemp(0, temp1); diff --git a/js/src/ion/arm/LOpcodes-arm.h b/js/src/ion/arm/LOpcodes-arm.h index e0ac2aceb84d..a7f2cc12e4c2 100644 --- a/js/src/ion/arm/LOpcodes-arm.h +++ b/js/src/ion/arm/LOpcodes-arm.h @@ -20,7 +20,7 @@ _(ModMaskI) \ _(PowHalfD) \ _(UInt32ToDouble) \ - _(AsmJSDivOrMod) \ + _(UDivOrMod) \ _(AsmJSLoadFuncPtr) diff --git a/js/src/ion/arm/Lowering-arm.cpp b/js/src/ion/arm/Lowering-arm.cpp index e0d43961fc00..e045ae9d67ac 100644 --- a/js/src/ion/arm/Lowering-arm.cpp +++ b/js/src/ion/arm/Lowering-arm.cpp @@ -228,6 +228,9 @@ LIRGeneratorARM::lowerForShift(LInstructionHelper<1, 2, 0> *ins, MDefinition *mi bool LIRGeneratorARM::lowerDivI(MDiv *div) { + if (div->isUnsigned()) + return lowerUDiv(div); + // Division instructions are slow. Division by constant denominators can be // rewritten to use other instructions. if (div->rhs()->isConstant()) { @@ -273,6 +276,9 @@ LIRGeneratorARM::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs) bool LIRGeneratorARM::lowerModI(MMod *mod) { + if (mod->isUnsigned()) + return lowerUMod(mod); + if (mod->rhs()->isConstant()) { int32_t rhs = mod->rhs()->toConstant()->value().toInt32(); int32_t shift; @@ -430,24 +436,37 @@ LIRGeneratorARM::visitAsmJSNeg(MAsmJSNeg *ins) JS_ASSERT(ins->type() == MIRType_Double); return define(new LNegD(useRegisterAtStart(ins->input())), ins); } + bool -LIRGeneratorARM::visitAsmJSUDiv(MAsmJSUDiv *div) +LIRGeneratorARM::lowerUDiv(MInstruction *div) { - LAsmJSDivOrMod *lir = new LAsmJSDivOrMod(useFixed(div->lhs(), r0), - useFixed(div->rhs(), r1), - tempFixed(r2), tempFixed(r3)); + LUDivOrMod *lir = new LUDivOrMod(useFixed(div->getOperand(0), r0), + useFixed(div->getOperand(1), r1), + tempFixed(r2), tempFixed(r3)); return defineFixed(lir, div, LAllocation(AnyRegister(r0))); } bool -LIRGeneratorARM::visitAsmJSUMod(MAsmJSUMod *mod) +LIRGeneratorARM::visitAsmJSUDiv(MAsmJSUDiv *div) { - LAsmJSDivOrMod *lir = new LAsmJSDivOrMod(useFixed(mod->lhs(), r0), - useFixed(mod->rhs(), r1), - tempFixed(r2), tempFixed(r3)); + return lowerUDiv(div); +} + +bool +LIRGeneratorARM::lowerUMod(MInstruction *mod) +{ + LUDivOrMod *lir = new LUDivOrMod(useFixed(mod->getOperand(0), r0), + useFixed(mod->getOperand(1), r1), + tempFixed(r2), tempFixed(r3)); return defineFixed(lir, mod, LAllocation(AnyRegister(r1))); } +bool +LIRGeneratorARM::visitAsmJSUMod(MAsmJSUMod *mod) +{ + return lowerUMod(mod); +} + bool LIRGeneratorARM::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) { diff --git a/js/src/ion/arm/Lowering-arm.h b/js/src/ion/arm/Lowering-arm.h index 6b780766ebb5..5f9c1fb33303 100644 --- a/js/src/ion/arm/Lowering-arm.h +++ b/js/src/ion/arm/Lowering-arm.h @@ -52,6 +52,8 @@ class LIRGeneratorARM : public LIRGeneratorShared bool lowerDivI(MDiv *div); bool lowerModI(MMod *mod); bool lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs); + bool lowerUDiv(MInstruction *div); + bool lowerUMod(MInstruction *mod); bool visitPowHalf(MPowHalf *ins); bool visitAsmJSNeg(MAsmJSNeg *ins); bool visitAsmJSUDiv(MAsmJSUDiv *ins); diff --git a/js/src/ion/shared/Assembler-x86-shared.cpp b/js/src/ion/shared/Assembler-x86-shared.cpp index e7c4bee729a3..8ad1e5f263ff 100644 --- a/js/src/ion/shared/Assembler-x86-shared.cpp +++ b/js/src/ion/shared/Assembler-x86-shared.cpp @@ -7,8 +7,6 @@ #include "ion/IonMacroAssembler.h" #include "gc/Marking.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/shared/CodeGenerator-x86-shared.cpp b/js/src/ion/shared/CodeGenerator-x86-shared.cpp index e74d6db8e1a6..064a87cfc817 100644 --- a/js/src/ion/shared/CodeGenerator-x86-shared.cpp +++ b/js/src/ion/shared/CodeGenerator-x86-shared.cpp @@ -625,7 +625,7 @@ CodeGeneratorX86Shared::visitMulI(LMulI *ins) } bool -CodeGeneratorX86Shared::visitAsmJSDivOrMod(LAsmJSDivOrMod *ins) +CodeGeneratorX86Shared::visitUDivOrMod(LUDivOrMod *ins) { JS_ASSERT(ToRegister(ins->lhs()) == eax); Register rhs = ToRegister(ins->rhs()); diff --git a/js/src/ion/shared/CodeGenerator-x86-shared.h b/js/src/ion/shared/CodeGenerator-x86-shared.h index 09d83d1e44bf..8871170aa55f 100644 --- a/js/src/ion/shared/CodeGenerator-x86-shared.h +++ b/js/src/ion/shared/CodeGenerator-x86-shared.h @@ -106,7 +106,7 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared virtual bool visitGuardObjectType(LGuardObjectType *guard); virtual bool visitGuardClass(LGuardClass *guard); virtual bool visitEffectiveAddress(LEffectiveAddress *ins); - virtual bool visitAsmJSDivOrMod(LAsmJSDivOrMod *ins); + virtual bool visitUDivOrMod(LUDivOrMod *ins); virtual bool visitAsmJSPassStackArg(LAsmJSPassStackArg *ins); bool visitNegI(LNegI *lir); diff --git a/js/src/ion/shared/IonFrames-x86-shared.cpp b/js/src/ion/shared/IonFrames-x86-shared.cpp index fe9dc1f19531..fe5bd1c65b69 100644 --- a/js/src/ion/shared/IonFrames-x86-shared.cpp +++ b/js/src/ion/shared/IonFrames-x86-shared.cpp @@ -7,8 +7,6 @@ #include "ion/Ion.h" #include "ion/IonFrames.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/shared/LIR-x86-shared.h b/js/src/ion/shared/LIR-x86-shared.h index 6856de9d37ef..3dcddfcc0961 100644 --- a/js/src/ion/shared/LIR-x86-shared.h +++ b/js/src/ion/shared/LIR-x86-shared.h @@ -97,12 +97,12 @@ class LModI : public LBinaryMath<1> // This class performs a simple x86 'div', yielding either a quotient or remainder depending on // whether this instruction is defined to output eax (quotient) or edx (remainder). -class LAsmJSDivOrMod : public LBinaryMath<1> +class LUDivOrMod : public LBinaryMath<1> { public: - LIR_HEADER(AsmJSDivOrMod); + LIR_HEADER(UDivOrMod); - LAsmJSDivOrMod(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp) { + LUDivOrMod(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp) { setOperand(0, lhs); setOperand(1, rhs); setTemp(0, temp); diff --git a/js/src/ion/shared/Lowering-x86-shared.cpp b/js/src/ion/shared/Lowering-x86-shared.cpp index 23b67e9642d8..0b9ebfe3ed9e 100644 --- a/js/src/ion/shared/Lowering-x86-shared.cpp +++ b/js/src/ion/shared/Lowering-x86-shared.cpp @@ -125,6 +125,9 @@ LIRGeneratorX86Shared::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs) bool LIRGeneratorX86Shared::lowerDivI(MDiv *div) { + if (div->isUnsigned()) + return lowerUDiv(div); + // Division instructions are slow. Division by constant denominators can be // rewritten to use other instructions. if (div->rhs()->isConstant()) { @@ -154,6 +157,9 @@ LIRGeneratorX86Shared::lowerDivI(MDiv *div) bool LIRGeneratorX86Shared::lowerModI(MMod *mod) { + if (mod->isUnsigned()) + return lowerUMod(mod); + if (mod->rhs()->isConstant()) { int32_t rhs = mod->rhs()->toConstant()->value().toInt32(); int32_t shift; @@ -182,23 +188,35 @@ LIRGeneratorX86Shared::visitAsmJSNeg(MAsmJSNeg *ins) } bool -LIRGeneratorX86Shared::visitAsmJSUDiv(MAsmJSUDiv *div) +LIRGeneratorX86Shared::lowerUDiv(MInstruction *div) { - LAsmJSDivOrMod *lir = new LAsmJSDivOrMod(useFixed(div->lhs(), eax), - useRegister(div->rhs()), - tempFixed(edx)); + LUDivOrMod *lir = new LUDivOrMod(useFixed(div->getOperand(0), eax), + useRegister(div->getOperand(1)), + tempFixed(edx)); return defineFixed(lir, div, LAllocation(AnyRegister(eax))); } bool -LIRGeneratorX86Shared::visitAsmJSUMod(MAsmJSUMod *mod) +LIRGeneratorX86Shared::visitAsmJSUDiv(MAsmJSUDiv *div) +{ + return lowerUDiv(div); +} + +bool +LIRGeneratorX86Shared::lowerUMod(MInstruction *mod) { - LAsmJSDivOrMod *lir = new LAsmJSDivOrMod(useFixed(mod->lhs(), eax), - useRegister(mod->rhs()), - LDefinition::BogusTemp()); + LUDivOrMod *lir = new LUDivOrMod(useFixed(mod->getOperand(0), eax), + useRegister(mod->getOperand(1)), + LDefinition::BogusTemp()); return defineFixed(lir, mod, LAllocation(AnyRegister(edx))); } +bool +LIRGeneratorX86Shared::visitAsmJSUMod(MAsmJSUMod *mod) +{ + return lowerUMod(mod); +} + bool LIRGeneratorX86Shared::lowerUrshD(MUrsh *mir) { diff --git a/js/src/ion/shared/Lowering-x86-shared.h b/js/src/ion/shared/Lowering-x86-shared.h index 194d73edd145..ac0fb4f467df 100644 --- a/js/src/ion/shared/Lowering-x86-shared.h +++ b/js/src/ion/shared/Lowering-x86-shared.h @@ -41,6 +41,8 @@ class LIRGeneratorX86Shared : public LIRGeneratorShared bool lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs); bool lowerDivI(MDiv *div); bool lowerModI(MMod *mod); + bool lowerUDiv(MInstruction *div); + bool lowerUMod(MInstruction *mod); bool lowerUrshD(MUrsh *mir); bool lowerConstantDouble(double d, MInstruction *ins); bool lowerTruncateDToInt32(MTruncateToInt32 *ins); diff --git a/js/src/ion/shared/MoveEmitter-x86-shared.cpp b/js/src/ion/shared/MoveEmitter-x86-shared.cpp index 6db7fe32761b..0dfb3c270bd1 100644 --- a/js/src/ion/shared/MoveEmitter-x86-shared.cpp +++ b/js/src/ion/shared/MoveEmitter-x86-shared.cpp @@ -6,8 +6,6 @@ #include "ion/shared/MoveEmitter-x86-shared.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/x64/Assembler-x64.cpp b/js/src/ion/x64/Assembler-x64.cpp index 77572a390e94..5a0c14d04c4e 100644 --- a/js/src/ion/x64/Assembler-x64.cpp +++ b/js/src/ion/x64/Assembler-x64.cpp @@ -8,8 +8,6 @@ #include "gc/Marking.h" #include "ion/LIR.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/x64/LOpcodes-x64.h b/js/src/ion/x64/LOpcodes-x64.h index ccf003ae731c..9907c36f79f7 100644 --- a/js/src/ion/x64/LOpcodes-x64.h +++ b/js/src/ion/x64/LOpcodes-x64.h @@ -18,6 +18,6 @@ _(PowHalfD) \ _(UInt32ToDouble) \ _(AsmJSLoadFuncPtr) \ - _(AsmJSDivOrMod) + _(UDivOrMod) #endif /* ion_x64_LOpcodes_x64_h */ diff --git a/js/src/ion/x64/MacroAssembler-x64.cpp b/js/src/ion/x64/MacroAssembler-x64.cpp index 07a8d1f5b6e0..fce31293d76c 100644 --- a/js/src/ion/x64/MacroAssembler-x64.cpp +++ b/js/src/ion/x64/MacroAssembler-x64.cpp @@ -10,8 +10,6 @@ #include "ion/IonFrames.h" #include "mozilla/Casting.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/x64/Trampoline-x64.cpp b/js/src/ion/x64/Trampoline-x64.cpp index cfc04ae14eba..8776956095b3 100644 --- a/js/src/ion/x64/Trampoline-x64.cpp +++ b/js/src/ion/x64/Trampoline-x64.cpp @@ -15,8 +15,6 @@ #include "ion/x64/BaselineHelpers-x64.h" #include "ion/ExecutionModeInlines.h" -#include "jsscriptinlines.h" - using namespace js; using namespace js::ion; diff --git a/js/src/ion/x86/LOpcodes-x86.h b/js/src/ion/x86/LOpcodes-x86.h index a3ecf8e20e60..b2410688911d 100644 --- a/js/src/ion/x86/LOpcodes-x86.h +++ b/js/src/ion/x86/LOpcodes-x86.h @@ -19,6 +19,6 @@ _(PowHalfD) \ _(UInt32ToDouble) \ _(AsmJSLoadFuncPtr) \ - _(AsmJSDivOrMod) + _(UDivOrMod) #endif /* ion_x86_LOpcodes_x86_h */ diff --git a/js/src/jit-test/tests/asm.js/testBug892291.js b/js/src/jit-test/tests/asm.js/testBug892291.js new file mode 100644 index 000000000000..9e0ae9761085 --- /dev/null +++ b/js/src/jit-test/tests/asm.js/testBug892291.js @@ -0,0 +1,10 @@ +function a(stdlib) { + "use asm"; + var imul = stdlib.Math.imul; + function f() { + return ((imul(-800, 0xf8ba1243)|0) % -1)|0; + } + return f; +} +var f = a(this); +assertEq(f(), 0); diff --git a/js/src/jit-test/tests/gc/bug-891773.js b/js/src/jit-test/tests/gc/bug-891773.js new file mode 100644 index 000000000000..e195399cf78c --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-891773.js @@ -0,0 +1,14 @@ +x = newGlobal() +Int32Array = x.Int32Array +x.p = ArrayBuffer() +schedulegc(29); +(function(stdlib, n, heap) { + "use asm" + var Int32ArrayView = new stdlib.Int32Array(heap) + function f() { + Int32ArrayView[1] + } + return f +})(this, { + f: new Function +}, ArrayBuffer()) diff --git a/js/src/jsapi-tests/testBug604087.cpp b/js/src/jsapi-tests/testBug604087.cpp index 7d99a7c185e2..5f72b9aa99b7 100644 --- a/js/src/jsapi-tests/testBug604087.cpp +++ b/js/src/jsapi-tests/testBug604087.cpp @@ -72,15 +72,15 @@ BEGIN_TEST(testBug604087) JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2)); CHECK(c2wrapper); - js::SetProxyExtra(c2wrapper, 0, js::Int32Value(2)); + c2wrapper->as().setExtra(0, js::Int32Value(2)); JS::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3)); CHECK(c3wrapper); - js::SetProxyExtra(c3wrapper, 0, js::Int32Value(3)); + c3wrapper->as().setExtra(0, js::Int32Value(3)); JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4)); CHECK(c4wrapper); - js::SetProxyExtra(c4wrapper, 0, js::Int32Value(4)); + c4wrapper->as().setExtra(0, js::Int32Value(4)); compartment4 = c4wrapper = NULL; JS::RootedObject next(cx); diff --git a/js/src/jsapi-tests/testNewObject.cpp b/js/src/jsapi-tests/testNewObject.cpp index 3f47b5a1d0a3..cfbe980fc8dd 100644 --- a/js/src/jsapi-tests/testNewObject.cpp +++ b/js/src/jsapi-tests/testNewObject.cpp @@ -19,7 +19,7 @@ constructHook(JSContext *cx, unsigned argc, jsval *vp) // Check that arguments were passed properly from JS_New. JS::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))); - JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js::Jsvalify(&js::ObjectClass), vp)); + JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js::Jsvalify(&JSObject::class_), vp)); if (!obj) { JS_ReportError(cx, "test failed, could not construct object"); return false; diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 8785d082d00a..398a48fa992e 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -114,7 +114,7 @@ JS::detail::CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl if (thisv.isObject()) { JSObject &thisObj = args.thisv().toObject(); - if (thisObj.isProxy()) + if (thisObj.is()) return Proxy::nativeCall(cx, test, impl, args); } @@ -1761,7 +1761,7 @@ StdNameToPropertyName(JSContext *cx, const JSStdName *stdn) */ static const JSStdName standard_class_atoms[] = { {js_InitFunctionClass, EAGER_CLASS_ATOM(Function), &JSFunction::class_}, - {js_InitObjectClass, EAGER_ATOM_AND_CLASP(Object)}, + {js_InitObjectClass, EAGER_CLASS_ATOM(Object), &JSObject::class_}, {js_InitArrayClass, EAGER_ATOM_AND_OCLASP(Array)}, {js_InitBooleanClass, EAGER_ATOM_AND_OCLASP(Boolean)}, {js_InitDateClass, EAGER_ATOM_AND_OCLASP(Date)}, @@ -1779,7 +1779,7 @@ static const JSStdName standard_class_atoms[] = { #ifdef ENABLE_PARALLEL_JS {js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)}, #endif - {js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), &js::ObjectProxyClass}, + {js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)}, #if ENABLE_INTL_API {js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)}, #endif @@ -1792,7 +1792,7 @@ static const JSStdName standard_class_atoms[] = { * this table. */ static const JSStdName standard_class_names[] = { - {js_InitObjectClass, EAGER_ATOM(eval), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(eval), &JSObject::class_}, /* Global properties and functions defined by the Number class. */ {js_InitNumberClass, EAGER_ATOM(NaN), OCLASP(Number)}, @@ -1844,25 +1844,25 @@ static const JSStdName standard_class_names[] = { static const JSStdName object_prototype_names[] = { /* Object.prototype properties (global delegates to Object.prototype). */ - {js_InitObjectClass, EAGER_ATOM(proto), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(proto), &JSObject::class_}, #if JS_HAS_TOSOURCE - {js_InitObjectClass, EAGER_ATOM(toSource), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(toSource), &JSObject::class_}, #endif - {js_InitObjectClass, EAGER_ATOM(toString), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(toLocaleString), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(valueOf), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(toString), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(toLocaleString), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(valueOf), &JSObject::class_}, #if JS_HAS_OBJ_WATCHPOINT - {js_InitObjectClass, EAGER_ATOM(watch), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(unwatch), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(watch), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(unwatch), &JSObject::class_}, #endif - {js_InitObjectClass, EAGER_ATOM(hasOwnProperty), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(isPrototypeOf), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(propertyIsEnumerable), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(hasOwnProperty), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(isPrototypeOf), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(propertyIsEnumerable), &JSObject::class_}, #if OLD_GETTER_SETTER_METHODS - {js_InitObjectClass, EAGER_ATOM(defineGetter), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(defineSetter), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(lookupGetter), CLASP(Object)}, - {js_InitObjectClass, EAGER_ATOM(lookupSetter), CLASP(Object)}, + {js_InitObjectClass, EAGER_ATOM(defineGetter), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(defineSetter), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(lookupGetter), &JSObject::class_}, + {js_InitObjectClass, EAGER_ATOM(lookupSetter), &JSObject::class_}, #endif {NULL, 0, NULL} @@ -3342,7 +3342,7 @@ JS_NewObject(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, JSObject *pare Class *clasp = Valueify(jsclasp); if (!clasp) - clasp = &ObjectClass; /* default class is Object */ + clasp = &JSObject::class_; /* default class is Object */ JS_ASSERT(clasp != &JSFunction::class_); JS_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); @@ -3372,7 +3372,7 @@ JS_NewObjectWithGivenProto(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, Class *clasp = Valueify(jsclasp); if (!clasp) - clasp = &ObjectClass; /* default class is Object */ + clasp = &JSObject::class_; /* default class is Object */ JS_ASSERT(clasp != &JSFunction::class_); JS_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); @@ -3483,7 +3483,7 @@ LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id, } if (!obj2->isNative()) { - if (obj2->isProxy()) { + if (obj2->is()) { AutoPropertyDescriptorRooter desc(cx); if (!Proxy::getPropertyDescriptor(cx, obj2, id, &desc, 0)) return false; @@ -3906,7 +3906,7 @@ JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, JSClass *jscl Class *clasp = Valueify(jsclasp); if (!clasp) - clasp = &ObjectClass; /* default class is Object */ + clasp = &JSObject::class_; /* default class is Object */ RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, proto, obj)); if (!nobj) @@ -3994,7 +3994,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned desc->value.setUndefined(); } } else { - if (obj2->isProxy()) { + if (obj2->is()) { JSAutoResolveFlags rf(cx, flags); return own ? Proxy::getOwnPropertyDescriptor(cx, obj2, id, desc, 0) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index ddf58669a177..fadebbadd1af 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -30,8 +30,6 @@ #include "vm/StringBuffer.h" #include "jsatominlines.h" -#include "jscntxtinlines.h" -#include "jsstrinlines.h" #include "vm/ArrayObject-inl.h" #include "vm/ArgumentsObject-inl.h" diff --git a/js/src/jsbool.cpp b/js/src/jsbool.cpp index ed1d944735d6..3b2ab42b9b9f 100644 --- a/js/src/jsbool.cpp +++ b/js/src/jsbool.cpp @@ -17,6 +17,7 @@ #include "jsobj.h" #include "vm/GlobalObject.h" +#include "vm/ProxyObject.h" #include "vm/StringBuffer.h" #include "jsboolinlines.h" @@ -200,7 +201,7 @@ js::ToBooleanSlow(const Value &v) bool js::BooleanGetPrimitiveValueSlow(HandleObject wrappedBool, JSContext *cx) { - JS_ASSERT(wrappedBool->isProxy()); + JS_ASSERT(wrappedBool->is()); JSObject *obj = Wrapper::wrappedObject(wrappedBool); JS_ASSERT(obj); return obj->as().unbox(); diff --git a/js/src/jsclone.cpp b/js/src/jsclone.cpp index a4907b976e7f..192e6c422b90 100644 --- a/js/src/jsclone.cpp +++ b/js/src/jsclone.cpp @@ -692,7 +692,7 @@ JSStructuredCloneWriter::startWrite(const Value &v) return writeTypedArray(obj); } else if (obj->is() && obj->as().hasData()) { return writeArrayBuffer(obj); - } else if (obj->isObject() || obj->is()) { + } else if (obj->is() || obj->is()) { return traverseObject(obj); } else if (obj->is()) { return out.writePair(SCTAG_BOOLEAN_OBJECT, obj->as().unbox()); @@ -1099,7 +1099,7 @@ JSStructuredCloneReader::startRead(Value *vp) case SCTAG_OBJECT_OBJECT: { JSObject *obj = (tag == SCTAG_ARRAY_OBJECT) ? NewDenseEmptyArray(context()) - : NewBuiltinClassInstance(context(), &ObjectClass); + : NewBuiltinClassInstance(context(), &JSObject::class_); if (!obj || !objs.append(ObjectValue(*obj))) return false; vp->setObject(*obj); diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 41be166db049..fc06285be1b4 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -278,7 +278,7 @@ CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args) * * - (new Object(Object)) returns the callee. */ - JS_ASSERT_IF(native != FunctionProxyClass.construct && + JS_ASSERT_IF(native != FunctionProxyObject::class_.construct && native != js::CallOrConstructBoundFunction && native != js::IteratorConstructor && (!callee->is() || callee->as().native() != obj_construct), diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index 9397bd24f14b..70a633930a4c 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -312,7 +312,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingA if (existing) { /* Is it possible to reuse |existing|? */ if (!existing->getTaggedProto().isLazy() || - existing->getClass() != &ObjectProxyClass || + // Note: don't use is() here -- it also matches subclasses! + existing->getClass() != &ObjectProxyObject::class_ || existing->getParent() != global || obj->isCallable()) { @@ -455,15 +456,15 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer *trc) for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { Value v = e.front().value; if (e.front().key.kind == CrossCompartmentKey::ObjectWrapper) { - JSObject *wrapper = &v.toObject(); + ProxyObject *wrapper = &v.toObject().as(); /* * We have a cross-compartment wrapper. Its private pointer may * point into the compartment being collected, so we should mark it. */ - Value referent = GetProxyPrivate(wrapper); + Value referent = wrapper->private_(); MarkValueRoot(trc, &referent, "cross-compartment wrapper"); - JS_ASSERT(referent == GetProxyPrivate(wrapper)); + JS_ASSERT(referent == wrapper->private_()); } } } diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index da90432ef86d..d254b5832733 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -44,7 +44,6 @@ #include "vm/StringBuffer.h" #include "jsobjinlines.h" -#include "jsstrinlines.h" using namespace js; using namespace js::types; diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 6606c01fcdfc..16669e52ac08 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -30,7 +30,6 @@ #include "jsfuninlines.h" #include "jsobjinlines.h" -#include "jsstrinlines.h" using namespace js; using namespace js::gc; diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index b1c9313b1419..1e61d60efcf5 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -574,12 +574,11 @@ JS_GetCustomIteratorCount(JSContext *cx) JS_FRIEND_API(JSBool) JS_IsDeadWrapper(JSObject *obj) { - if (!IsProxy(obj)) { + if (!obj->is()) { return false; } - BaseProxyHandler *handler = GetProxyHandler(obj); - return handler->family() == &DeadObjectProxy::sDeadObjectFamily; + return obj->as().handler()->family() == &DeadObjectProxy::sDeadObjectFamily; } void diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 27bb6457c133..6753fd3c6b37 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -387,10 +387,15 @@ struct Atom { } /* namespace shadow */ -extern JS_FRIEND_DATA(js::Class) FunctionProxyClass; -extern JS_FRIEND_DATA(js::Class) OuterWindowProxyClass; -extern JS_FRIEND_DATA(js::Class) ObjectProxyClass; -extern JS_FRIEND_DATA(js::Class) ObjectClass; +// These are equal to |&{Function,Object,OuterWindow}ProxyObject::class_|. Use +// them in places where you don't want to #include vm/ProxyObject.h. +extern JS_FRIEND_DATA(js::Class*) FunctionProxyClassPtr; +extern JS_FRIEND_DATA(js::Class*) ObjectProxyClassPtr; +extern JS_FRIEND_DATA(js::Class*) OuterWindowProxyClassPtr; + +// This is equal to |&JSObject::class_|. Use it in places where you don't want +// to #include jsobj.h. +extern JS_FRIEND_DATA(js::Class*) ObjectClassPtr; inline js::Class * GetObjectClass(JSObject *obj) @@ -492,9 +497,9 @@ inline bool GetObjectProto(JSContext *cx, JS::Handle obj, JS::MutableHandle proto) { js::Class *clasp = GetObjectClass(obj); - if (clasp == &js::ObjectProxyClass || - clasp == &js::OuterWindowProxyClass || - clasp == &js::FunctionProxyClass) + if (clasp == js::ObjectProxyClassPtr || + clasp == js::OuterWindowProxyClassPtr || + clasp == js::FunctionProxyClassPtr) { return JS_GetPrototype(cx, obj, proto.address()); } diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 930dd8f922a5..da5a986900ff 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -34,7 +34,6 @@ #include "vm/Xdr.h" #include "jsfuninlines.h" -#include "jsinferinlines.h" #include "jsscriptinlines.h" #include "vm/Interpreter-inl.h" @@ -211,7 +210,7 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj) JSObject *objProto = obj->global().getOrCreateObjectPrototype(cx); if (!objProto) return NULL; - RootedObject proto(cx, NewObjectWithGivenProto(cx, &ObjectClass, objProto, NULL, SingletonObject)); + RootedObject proto(cx, NewObjectWithGivenProto(cx, &JSObject::class_, objProto, NULL, SingletonObject)); if (!proto) return NULL; @@ -747,7 +746,7 @@ JSString * fun_toStringHelper(JSContext *cx, HandleObject obj, unsigned indent) { if (!obj->is()) { - if (IsFunctionProxy(obj)) + if (obj->is()) return Proxy::fun_toString(cx, obj, indent); JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 8204dda62c4e..c4aa98a6bb09 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -65,6 +65,7 @@ using mozilla::Swap; #include "gc/Marking.h" #include "gc/Memory.h" #include "vm/Debugger.h" +#include "vm/ProxyObject.h" #include "vm/Shape.h" #include "vm/String.h" #include "vm/ForkJoin.h" @@ -3365,20 +3366,19 @@ IsGrayListObject(JSObject *obj) return IsCrossCompartmentWrapper(obj) && !IsDeadProxyObject(obj); } -const unsigned JSSLOT_GC_GRAY_LINK = JSSLOT_PROXY_EXTRA + 1; - -static unsigned -GrayLinkSlot(JSObject *obj) +/* static */ unsigned +ProxyObject::grayLinkSlot(JSObject *obj) { JS_ASSERT(IsGrayListObject(obj)); - return JSSLOT_GC_GRAY_LINK; + return ProxyObject::EXTRA_SLOT + 1; } #ifdef DEBUG static void AssertNotOnGrayList(JSObject *obj) { - JS_ASSERT_IF(IsGrayListObject(obj), obj->getReservedSlot(GrayLinkSlot(obj)).isUndefined()); + JS_ASSERT_IF(IsGrayListObject(obj), + obj->getReservedSlot(ProxyObject::grayLinkSlot(obj)).isUndefined()); } #endif @@ -3386,13 +3386,13 @@ static JSObject * CrossCompartmentPointerReferent(JSObject *obj) { JS_ASSERT(IsGrayListObject(obj)); - return &GetProxyPrivate(obj).toObject(); + return &obj->as().private_().toObject(); } static JSObject * NextIncomingCrossCompartmentPointer(JSObject *prev, bool unlink) { - unsigned slot = GrayLinkSlot(prev); + unsigned slot = ProxyObject::grayLinkSlot(prev); JSObject *next = prev->getReservedSlot(slot).toObjectOrNull(); JS_ASSERT_IF(next, IsGrayListObject(next)); @@ -3408,7 +3408,7 @@ js::DelayCrossCompartmentGrayMarking(JSObject *src) JS_ASSERT(IsGrayListObject(src)); /* Called from MarkCrossCompartmentXXX functions. */ - unsigned slot = GrayLinkSlot(src); + unsigned slot = ProxyObject::grayLinkSlot(src); JSObject *dest = CrossCompartmentPointerReferent(src); JSCompartment *comp = dest->compartment(); @@ -3486,7 +3486,7 @@ RemoveFromGrayList(JSObject *wrapper) if (!IsGrayListObject(wrapper)) return false; - unsigned slot = GrayLinkSlot(wrapper); + unsigned slot = ProxyObject::grayLinkSlot(wrapper); if (wrapper->getReservedSlot(slot).isUndefined()) return false; /* Not on our list. */ @@ -3501,7 +3501,7 @@ RemoveFromGrayList(JSObject *wrapper) } while (obj) { - unsigned slot = GrayLinkSlot(obj); + unsigned slot = ProxyObject::grayLinkSlot(obj); JSObject *next = obj->getReservedSlot(slot).toObjectOrNull(); if (next == wrapper) { obj->setCrossCompartmentSlot(slot, ObjectOrNullValue(tail)); diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index c3ea5faf9d0f..fafa26c96fd1 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -3300,7 +3300,7 @@ TypeCompartment::fixObjectType(JSContext *cx, JSObject *obj) * Use the same type object for all singleton/JSON objects with the same * base shape, i.e. the same fields written in the same order. */ - JS_ASSERT(obj->isObject()); + JS_ASSERT(obj->is()); if (obj->slotSpan() == 0 || obj->inDictionaryMode() || !obj->hasEmptyElements()) return; @@ -3333,7 +3333,7 @@ TypeCompartment::fixObjectType(JSContext *cx, JSObject *obj) /* Make a new type to use for the object and similar future ones. */ Rooted objProto(cx, obj->getTaggedProto()); - TypeObject *objType = newTypeObject(cx, &ObjectClass, objProto); + TypeObject *objType = newTypeObject(cx, &JSObject::class_, objProto); if (!objType || !objType->addDefiniteProperties(cx, obj)) { cx->compartment()->types.setPendingNukeTypes(cx); return; @@ -3413,7 +3413,7 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n return NULL; gc::AllocKind allocKind = gc::GetGCObjectKind(nproperties); - size_t nfixed = gc::GetGCKindSlots(allocKind, &ObjectClass); + size_t nfixed = gc::GetGCKindSlots(allocKind, &JSObject::class_); ObjectTableKey::Lookup lookup(properties, nproperties, nfixed); ObjectTypeTable::AddPtr p = objectTypeTable->lookupForAdd(lookup); @@ -3421,7 +3421,7 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n if (!p) return NULL; - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass, allocKind)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind)); if (!obj) { cx->clearPendingException(); return NULL; @@ -5213,7 +5213,7 @@ CheckNewScriptProperties(JSContext *cx, HandleTypeObject type, HandleFunction fu state.thisFunction = fun; /* Strawman object to add properties to and watch for duplicates. */ - state.baseobj = NewBuiltinClassInstance(cx, &ObjectClass, gc::FINALIZE_OBJECT16); + state.baseobj = NewBuiltinClassInstance(cx, &JSObject::class_, gc::FINALIZE_OBJECT16); if (!state.baseobj) { if (type->newScript) type->clearNewScript(cx); diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index ab32760d1137..5712b768ddd5 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -461,7 +461,7 @@ GetClassForProtoKey(JSProtoKey key) { switch (key) { case JSProto_Object: - return &ObjectClass; + return &JSObject::class_; case JSProto_Array: return &ArrayObject::class_; diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index bf53905a9599..af6eecbfb6f6 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -106,7 +106,7 @@ Enumerate(JSContext *cx, HandleObject pobj, jsid id, if (JS_UNLIKELY(!pobj->getTaggedProto().isObject() && JSID_IS_ATOM(id, cx->names().proto))) return true; - if (!(flags & JSITER_OWNONLY) || pobj->isProxy() || pobj->getOps()->enumerate) { + if (!(flags & JSITER_OWNONLY) || pobj->is() || pobj->getOps()->enumerate) { /* If we've already seen this, we definitely won't add it. */ IdSet::AddPtr p = ht.lookupForAdd(id); if (JS_UNLIKELY(!!p)) @@ -117,7 +117,7 @@ Enumerate(JSContext *cx, HandleObject pobj, jsid id, * the prototype chain, but custom enumeration behaviors might return * duplicated properties, so always add in such cases. */ - if ((pobj->isProxy() || pobj->getProto() || pobj->getOps()->enumerate) && !ht.add(p, id)) + if ((pobj->is() || pobj->getProto() || pobj->getOps()->enumerate) && !ht.add(p, id)) return false; } @@ -206,7 +206,7 @@ Snapshot(JSContext *cx, JSObject *pobj_, unsigned flags, AutoIdVector *props) if (!EnumerateNativeProperties(cx, pobj, flags, ht, props)) return false; } else { - if (pobj->isProxy()) { + if (pobj->is()) { AutoIdVector proxyProps(cx); if (flags & JSITER_OWNONLY) { if (flags & JSITER_HIDDEN) { @@ -682,7 +682,7 @@ js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleVa } miss: - if (obj->isProxy()) { + if (obj->is()) { types::MarkIteratorUnknown(cx); return Proxy::iterate(cx, obj, flags, vp); } diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index b47d08f0bd0e..90ad9c744537 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -37,7 +37,7 @@ #include "vm/StringBuffer.h" #include "jsatominlines.h" -#include "jsstrinlines.h" + #include "vm/NumberObject-inl.h" #include "vm/String-inl.h" diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 2da17c1d78f2..3c475b0a9c5a 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -64,7 +64,7 @@ using mozilla::DebugOnly; JS_STATIC_ASSERT(int32_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)) == int64_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value))); -Class js::ObjectClass = { +Class JSObject::class_ = { js_Object_str, JSCLASS_HAS_CACHED_PROTO(JSProto_Object), JS_PropertyStub, /* addProperty */ @@ -76,6 +76,8 @@ Class js::ObjectClass = { JS_ConvertStub }; +JS_FRIEND_DATA(Class*) js::ObjectClassPtr = &JSObject::class_; + JS_FRIEND_API(JSObject *) JS_ObjectToInnerObject(JSContext *cx, JSObject *objArg) { @@ -234,7 +236,7 @@ PropDesc::makeObject(JSContext *cx) { MOZ_ASSERT(!isUndefined()); - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!obj) return false; @@ -267,7 +269,7 @@ js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, PropertyDescriptor *desc) { // FIXME: Call TrapGetOwnProperty directly once ScriptedIndirectProxies is removed - if (obj->isProxy()) + if (obj->is()) return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, 0); RootedObject pobj(cx); @@ -990,7 +992,7 @@ js::DefineProperty(JSContext *cx, HandleObject obj, HandleId id, const PropDesc * FIXME: Once ScriptedIndirectProxies are removed, this code should call * TrapDefineOwnProperty directly */ - if (obj->isProxy()) { + if (obj->is()) { RootedValue pd(cx, desc.pd()); return Proxy::defineProperty(cx, obj, id, pd); } @@ -1080,7 +1082,7 @@ js::DefineProperties(JSContext *cx, HandleObject obj, HandleObject props) * FIXME: Once ScriptedIndirectProxies are removed, this code should call * TrapDefineOwnProperty directly */ - if (obj->isProxy()) { + if (obj->is()) { for (size_t i = 0, len = ids.length(); i < len; i++) { RootedValue pd(cx, descs[i].pd()); if (!Proxy::defineProperty(cx, obj, ids.handleAt(i), pd)) @@ -1270,7 +1272,7 @@ JSObject::className(JSContext *cx, HandleObject obj) { assertSameCompartment(cx, obj); - if (obj->isProxy()) + if (obj->is()) return Proxy::className(cx, obj); return obj->getClass()->name; @@ -1465,11 +1467,11 @@ static JSObject * NewObjectWithType(JSContext *cx, HandleTypeObject type, JSObject *parent, gc::AllocKind allocKind, NewObjectKind newKind = GenericObject) { - JS_ASSERT(type->proto->hasNewType(&ObjectClass, type)); + JS_ASSERT(type->proto->hasNewType(&JSObject::class_, type)); JS_ASSERT(parent); JS_ASSERT(allocKind <= gc::FINALIZE_OBJECT_LAST); - if (CanBeFinalizedInBackground(allocKind, &ObjectClass)) + if (CanBeFinalizedInBackground(allocKind, &JSObject::class_)) allocKind = GetBackgroundAllocKind(allocKind); NewObjectCache &cache = cx->runtime()->newObjectCache; @@ -1479,19 +1481,19 @@ NewObjectWithType(JSContext *cx, HandleTypeObject type, JSObject *parent, gc::Al newKind == GenericObject && !cx->compartment()->objectMetadataCallback) { - if (cache.lookupType(&ObjectClass, type, allocKind, &entry)) { - JSObject *obj = cache.newObjectFromHit(cx, entry, GetInitialHeap(newKind, &ObjectClass)); + if (cache.lookupType(&JSObject::class_, type, allocKind, &entry)) { + JSObject *obj = cache.newObjectFromHit(cx, entry, GetInitialHeap(newKind, &JSObject::class_)); if (obj) return obj; } } - JSObject *obj = NewObject(cx, &ObjectClass, type, parent, allocKind, newKind); + JSObject *obj = NewObject(cx, &JSObject::class_, type, parent, allocKind, newKind); if (!obj) return NULL; if (entry != -1 && !obj->hasDynamicSlots()) - cache.fillType(entry, &ObjectClass, type, allocKind, obj); + cache.fillType(entry, &JSObject::class_, type, allocKind, obj); return obj; } @@ -1501,11 +1503,11 @@ js::NewObjectScriptedCall(JSContext *cx, MutableHandleObject pobj) { jsbytecode *pc; RootedScript script(cx, cx->currentScript(&pc)); - gc::AllocKind allocKind = NewObjectGCKind(&ObjectClass); + gc::AllocKind allocKind = NewObjectGCKind(&JSObject::class_); NewObjectKind newKind = script - ? UseNewTypeForInitializer(cx, script, pc, &ObjectClass) + ? UseNewTypeForInitializer(cx, script, pc, &JSObject::class_) : GenericObject; - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind)); if (!obj) return false; @@ -1594,7 +1596,7 @@ CreateThisForFunctionWithType(JSContext *cx, HandleTypeObject type, JSObject *pa return res; } - gc::AllocKind allocKind = NewObjectGCKind(&ObjectClass); + gc::AllocKind allocKind = NewObjectGCKind(&JSObject::class_); return NewObjectWithType(cx, type, parent, allocKind, newKind); } @@ -1605,13 +1607,13 @@ js::CreateThisForFunctionWithProto(JSContext *cx, HandleObject callee, JSObject RootedObject res(cx); if (proto) { - RootedTypeObject type(cx, cx->getNewType(&ObjectClass, proto, &callee->as())); + RootedTypeObject type(cx, cx->getNewType(&JSObject::class_, proto, &callee->as())); if (!type) return NULL; res = CreateThisForFunctionWithType(cx, type, callee->getParent(), newKind); } else { - gc::AllocKind allocKind = NewObjectGCKind(&ObjectClass); - res = NewObjectWithClassProto(cx, &ObjectClass, proto, callee->getParent(), allocKind, newKind); + gc::AllocKind allocKind = NewObjectGCKind(&JSObject::class_); + res = NewObjectWithClassProto(cx, &JSObject::class_, proto, callee->getParent(), allocKind, newKind); } if (res && cx->typeInferenceEnabled()) { @@ -1842,7 +1844,7 @@ CopySlots(JSContext *cx, HandleObject from, HandleObject to) JSObject * js::CloneObject(JSContext *cx, HandleObject obj, Handle proto, HandleObject parent) { - if (!obj->isNative() && !obj->isProxy()) { + if (!obj->isNative() && !obj->is()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CLONE_OBJECT); return NULL; @@ -1860,7 +1862,7 @@ js::CloneObject(JSContext *cx, HandleObject obj, Handle proto, if (obj->hasPrivate()) clone->setPrivate(obj->getPrivate()); } else { - JS_ASSERT(obj->isProxy()); + JS_ASSERT(obj->is()); if (!CopySlots(cx, obj, clone)) return NULL; } @@ -1872,9 +1874,9 @@ JSObject * js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj) { Rooted typeObj(cx); - typeObj = cx->getNewType(&ObjectClass, cx->global()->getOrCreateObjectPrototype(cx)); + typeObj = cx->getNewType(&JSObject::class_, cx->global()->getOrCreateObjectPrototype(cx)); - JS_ASSERT(srcObj->getClass() == &ObjectClass); + JS_ASSERT(srcObj->getClass() == &JSObject::class_); AllocKind kind = GetBackgroundAllocKind(GuessObjectGCKind(srcObj->numFixedSlots())); JS_ASSERT_IF(srcObj->isTenured(), kind == srcObj->tenuredGetAllocKind()); @@ -2847,7 +2849,7 @@ AllocateElements(ThreadSafeContext *cx, JSObject *obj, uint32_t nelems) { #ifdef JSGC_GENERATIONAL if (cx->isJSContext()) - return cx->asJSContext()->runtime()->gcNursery.allocateElements(cx, obj, nelems); + return cx->asJSContext()->runtime()->gcNursery.allocateElements(cx->asJSContext(), obj, nelems); #endif return static_cast(cx->malloc_(nelems * sizeof(HeapValue))); @@ -2859,7 +2861,7 @@ ReallocateElements(ThreadSafeContext *cx, JSObject *obj, ObjectElements *oldHead { #ifdef JSGC_GENERATIONAL if (cx->isJSContext()) { - return cx->asJSContext()->runtime()-> gcNursery.reallocateElements(cx, obj, oldHeader, + return cx->asJSContext()->runtime()-> gcNursery.reallocateElements(cx->asJSContext(), obj, oldHeader, oldCount, newCount); } #endif @@ -4154,7 +4156,7 @@ GetPropertyHelperInline(JSContext *cx, HandleObject receiverHandle = MaybeRooted::toHandle(receiver); HandleId idHandle = MaybeRooted::toHandle(id); MutableHandleValue vpHandle = MaybeRooted::toMutableHandle(vp); - return obj2->isProxy() + return obj2->template is() ? Proxy::get(cx, obj2Handle, receiverHandle, idHandle, vpHandle) : JSObject::getGeneric(cx, obj2Handle, obj2Handle, idHandle, vpHandle); } @@ -4515,7 +4517,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive return false; if (shape) { if (!pobj->isNative()) { - if (pobj->isProxy()) { + if (pobj->is()) { AutoPropertyDescriptorRooter pd(cx); if (!Proxy::getPropertyDescriptor(cx, pobj, id, &pd, JSRESOLVE_ASSIGNING)) return false; @@ -5293,7 +5295,7 @@ dumpValue(const Value &v) Class *clasp = obj->getClass(); fprintf(stderr, "<%s%s at %p>", clasp->name, - (clasp == &ObjectClass) ? "" : " object", + (clasp == &JSObject::class_) ? "" : " object", (void *) obj); } else if (v.isBoolean()) { if (v.toBoolean()) @@ -5375,7 +5377,7 @@ DumpProperty(JSObject *obj, Shape &shape) bool JSObject::uninlinedIsProxy() const { - return isProxy(); + return is(); } void @@ -5388,7 +5390,7 @@ JSObject::dump() fprintf(stderr, "flags:"); if (obj->isDelegate()) fprintf(stderr, " delegate"); - if (!obj->isProxy() && !obj->nonProxyIsExtensible()) fprintf(stderr, " not_extensible"); + if (!obj->is() && !obj->nonProxyIsExtensible()) fprintf(stderr, " not_extensible"); if (obj->isIndexed()) fprintf(stderr, " indexed"); if (obj->isNative()) { diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 254e1032e199..651f4f841aa7 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -190,7 +190,6 @@ DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, JSBool *succeeded); extern Class IntlClass; extern Class JSONClass; extern Class MathClass; -extern Class ObjectClass; class ArrayBufferObject; class GlobalObject; @@ -224,6 +223,8 @@ class JSObject : public js::ObjectImpl static js::types::TypeObject *makeLazyType(JSContext *cx, js::HandleObject obj); public: + static js::Class class_; + /* * Update the last property, keeping the number of allocated slots in sync * with the object's new slot span. @@ -993,11 +994,6 @@ class JSObject : public js::ObjectImpl * Note that X represents a low-level representation and does not query the * [[Class]] property of object defined by the spec (for this, see * js::ObjectClassIs). - * - * SpiderMonkey has not been completely switched to the is/as/XObject - * pattern so in some cases there is no XObject class and the engine - * instead pokes directly at reserved slots and getPrivate. In such cases, - * consider adding the missing XObject class. */ template @@ -1015,13 +1011,8 @@ class JSObject : public js::ObjectImpl return *static_cast(this); } - /* Direct subtypes of JSObject: */ - inline bool isObject() const { return hasClass(&js::ObjectClass); } - using js::ObjectImpl::isProxy; - /* Subtypes of Proxy. */ inline bool isWrapper() const; - inline bool isFunctionProxy() const { return hasClass(&js::FunctionProxyClass); } inline bool isCrossCompartmentWrapper() const; static inline js::ThingRootKind rootKind() { return js::THING_ROOT_OBJECT; } diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 57b9c4a584c0..9ab761f802aa 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -538,7 +538,7 @@ JSObject::setType(js::types::TypeObject *newType) JSObject::getProto(JSContext *cx, js::HandleObject obj, js::MutableHandleObject protop) { if (obj->getTaggedProto().isLazy()) { - JS_ASSERT(obj->isProxy()); + JS_ASSERT(obj->is()); return js::Proxy::getPrototypeOf(cx, obj, protop); } else { protop.set(obj->js::ObjectImpl::getProto()); @@ -850,7 +850,7 @@ IsNativeFunction(const js::Value &v, JSNative native) static JS_ALWAYS_INLINE bool ClassMethodIsNative(JSContext *cx, JSObject *obj, Class *clasp, jsid methodid, JSNative native) { - JS_ASSERT(!obj->isProxy()); + JS_ASSERT(!obj->is()); JS_ASSERT(obj->getClass() == clasp); Value v; @@ -1081,14 +1081,14 @@ NewObjectScriptedCall(JSContext *cx, MutableHandleObject obj); static inline JSObject * CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind = GenericObject) { - JS_ASSERT(baseobj->getClass() == &ObjectClass); + JS_ASSERT(baseobj->getClass() == &JSObject::class_); JS_ASSERT(!baseobj->inDictionaryMode()); gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots()); allocKind = gc::GetBackgroundAllocKind(allocKind); JS_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->tenuredGetAllocKind()); RootedObject obj(cx); - obj = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind); + obj = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind); if (!obj) return NULL; @@ -1157,7 +1157,7 @@ DefineConstructorAndPrototype(JSContext *cx, Handle global, inline bool ObjectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) { - if (JS_UNLIKELY(obj->isProxy())) + if (JS_UNLIKELY(obj->is())) return Proxy::objectClassIs(obj, classValue, cx); switch (classValue) { diff --git a/js/src/json.cpp b/js/src/json.cpp index 47f07f313eb9..b659f89fd098 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -25,7 +25,6 @@ #include "jsatominlines.h" #include "jsboolinlines.h" -#include "jsstrinlines.h" using namespace js; using namespace js::gc; @@ -635,7 +634,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp } /* Step 9. */ - RootedObject wrapper(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject wrapper(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!wrapper) return false; @@ -673,7 +672,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut RootedObject obj(cx, &val.toObject()); /* 'val' must have been produced by the JSON parser, so not a proxy. */ - JS_ASSERT(!obj->isProxy()); + JS_ASSERT(!obj->is()); if (obj->is()) { /* Step 2a(ii). */ uint32_t length = obj->as().length(); @@ -759,7 +758,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut static bool Revive(JSContext *cx, HandleValue reviver, MutableHandleValue vp) { - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!obj) return false; diff --git a/js/src/jsonparser.cpp b/js/src/jsonparser.cpp index 2aa2ad678874..1139d08d5011 100644 --- a/js/src/jsonparser.cpp +++ b/js/src/jsonparser.cpp @@ -536,7 +536,7 @@ JSONParser::createFinishedObject(PropertyVector &properties) * shape in manually. */ gc::AllocKind allocKind = gc::GetGCObjectKind(properties.length()); - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass, allocKind)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind)); if (!obj) return NULL; diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index deb705a55b2e..23c6f38610b5 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -37,7 +37,6 @@ #include "vm/StringBuffer.h" #include "jscntxtinlines.h" -#include "jsobjinlines.h" #include "jscompartmentinlines.h" #include "jsopcodeinlines.h" diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index e7f29badb030..691b1eb6f693 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -26,29 +26,6 @@ using namespace js; using namespace js::gc; using mozilla::ArrayLength; -static inline HeapSlot & -GetCall(JSObject *proxy) -{ - JS_ASSERT(IsFunctionProxy(proxy)); - return proxy->getSlotRef(JSSLOT_PROXY_CALL); -} - -static inline Value -GetConstruct(JSObject *proxy) -{ - if (proxy->slotSpan() <= JSSLOT_PROXY_CONSTRUCT) - return UndefinedValue(); - return proxy->getSlot(JSSLOT_PROXY_CONSTRUCT); -} - -static inline HeapSlot & -GetFunctionProxyConstruct(JSObject *proxy) -{ - JS_ASSERT(IsFunctionProxy(proxy)); - JS_ASSERT(proxy->slotSpan() > JSSLOT_PROXY_CONSTRUCT); - return proxy->getSlotRef(JSSLOT_PROXY_CONSTRUCT); -} - void js::AutoEnterPolicy::reportError(JSContext *cx, jsid id) { @@ -88,7 +65,7 @@ js::AutoEnterPolicy::recordLeave() JS_FRIEND_API(void) js::assertEnteredPolicy(JSContext *cx, JSObject *proxy, jsid id) { - MOZ_ASSERT(proxy->isProxy()); + MOZ_ASSERT(proxy->is()); MOZ_ASSERT(cx->runtime()->enteredPolicy); MOZ_ASSERT(cx->runtime()->enteredPolicy->enteredProxy.ref().get() == proxy); MOZ_ASSERT(cx->runtime()->enteredPolicy->enteredId.ref().get() == id); @@ -211,7 +188,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, } else if ((desc.attrs & JSPROP_SETTER) || desc.setter != JS_StrictPropertyStub) { if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, strict, vp)) return false; - if (!proxy->isProxy() || GetProxyHandler(proxy) != this) + if (!proxy->is() || proxy->as().handler() != this) return true; if (desc.attrs & JSPROP_SHARED) return true; @@ -238,7 +215,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, } else if ((desc.attrs & JSPROP_SETTER) || desc.setter != JS_StrictPropertyStub) { if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, strict, vp)) return false; - if (!proxy->isProxy() || GetProxyHandler(proxy) != this) + if (!proxy->is() || proxy->as().handler() != this) return true; if (desc.attrs & JSPROP_SHARED) return true; @@ -320,7 +297,7 @@ BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &a const char * BaseProxyHandler::className(JSContext *cx, HandleObject proxy) { - return IsFunctionProxy(proxy) ? "Function" : "Object"; + return proxy->is() ? "Function" : "Object"; } JSString * @@ -392,7 +369,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han { assertEnteredPolicy(cx, proxy, id); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JS_GetPropertyDescriptorById(cx, target, id, 0, desc); } @@ -402,7 +379,7 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, unsigned { // If obj is a proxy, we can do better than just guessing. This is // important for certain types of wrappers that wrap other wrappers. - if (obj->isProxy()) + if (obj->is()) return Proxy::getOwnPropertyDescriptor(cx, obj, id, desc, flags); if (!JS_GetPropertyDescriptorById(cx, obj, id, flags, desc)) @@ -417,7 +394,7 @@ DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc, unsigned flags) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return GetOwnPropertyDescriptor(cx, target, id, 0, desc); } @@ -426,7 +403,7 @@ DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId i PropertyDescriptor *desc) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); RootedValue v(cx, desc->value); return CheckDefineProperty(cx, target, id, v, desc->getter, desc->setter, desc->attrs) && JS_DefinePropertyById(cx, target, id, v, desc->getter, desc->setter, desc->attrs); @@ -437,7 +414,7 @@ DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return GetPropertyNames(cx, target, JSITER_OWNONLY | JSITER_HIDDEN, &props); } @@ -445,7 +422,7 @@ bool DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); RootedValue v(cx); if (!JS_DeletePropertyById2(cx, target, id, v.address())) return false; @@ -462,7 +439,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, { assertEnteredPolicy(cx, proxy, JSID_VOID); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return GetPropertyNames(cx, target, 0, &props); } @@ -470,7 +447,7 @@ bool DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedValue target(cx, GetProxyPrivate(proxy)); + RootedValue target(cx, proxy->as().private_()); return Invoke(cx, args.thisv(), target, args.length(), args.array(), args.rval()); } @@ -478,7 +455,7 @@ bool DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedValue target(cx, GetProxyPrivate(proxy)); + RootedValue target(cx, proxy->as().private_()); return InvokeConstructor(cx, target, args.length(), args.array(), args.rval().address()); } @@ -486,7 +463,7 @@ bool DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) { - args.setThis(ObjectValue(*GetProxyTargetObject(&args.thisv().toObject()))); + args.setThis(ObjectValue(*args.thisv().toObject().as().target())); if (!test(args.thisv())) { ReportIncompatible(cx, args); return false; @@ -501,7 +478,7 @@ DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandle { assertEnteredPolicy(cx, proxy, JSID_VOID); JSBool b; - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); if (!JS_HasInstance(cx, target, v, &b)) return false; *bp = !!b; @@ -513,15 +490,15 @@ bool DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) { - RootedObject obj(cx, GetProxyTargetObject(proxy)); - return ObjectClassIs(obj, classValue, cx); + RootedObject target(cx, proxy->as().target()); + return ObjectClassIs(target, classValue, cx); } const char * DirectProxyHandler::className(JSContext *cx, HandleObject proxy) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JSObject::className(cx, target); } @@ -530,7 +507,7 @@ DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return fun_toStringHelper(cx, target, indent); } @@ -538,7 +515,7 @@ bool DirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) { - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return RegExpToShared(cx, target, g); } @@ -546,7 +523,7 @@ bool DirectProxyHandler::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) { - vp.set(ObjectValue(*GetProxyTargetObject(proxy))); + vp.set(ObjectValue(*proxy->as().target())); if (hint == JSTYPE_VOID) return ToPrimitive(cx, vp); return ToPrimitive(cx, hint, vp); @@ -569,7 +546,7 @@ DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp assertEnteredPolicy(cx, proxy, id); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. JSBool found; - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); if (!JS_HasPropertyById(cx, target, id, &found)) return false; *bp = !!found; @@ -580,7 +557,7 @@ bool DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); AutoPropertyDescriptorRooter desc(cx); if (!JS_GetPropertyDescriptorById(cx, target, id, 0, &desc)) return false; @@ -593,7 +570,7 @@ DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver HandleId id, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JSObject::getGeneric(cx, target, receiver, id, vp); } @@ -602,7 +579,7 @@ DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver HandleId id, bool strict, MutableHandleValue vp) { assertEnteredPolicy(cx, proxy, id); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JSObject::setGeneric(cx, target, receiver, id, vp, strict); } @@ -610,7 +587,7 @@ bool DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return GetPropertyNames(cx, target, JSITER_OWNONLY, &props); } @@ -620,21 +597,21 @@ DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, { assertEnteredPolicy(cx, proxy, JSID_VOID); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return GetIterator(cx, target, flags, vp); } bool DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JSObject::isExtensible(cx, target, extensible); } bool DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) { - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); return JSObject::preventExtensions(cx, target); } @@ -757,6 +734,21 @@ ArrayToIdVector(JSContext *cx, const Value &array, AutoIdVector &props) return true; } +inline HeapSlot & +FunctionProxyObject::construct() +{ + JS_ASSERT(slotSpan() > CONSTRUCT_SLOT); + return getSlotRef(CONSTRUCT_SLOT); +} + +inline Value +FunctionProxyObject::constructOrUndefined() const +{ + if (slotSpan() <= CONSTRUCT_SLOT) + return UndefinedValue(); + return getSlot(CONSTRUCT_SLOT); +} + /* Derived class for all scripted indirect proxy handlers. */ class ScriptedIndirectProxyHandler : public BaseProxyHandler { @@ -845,7 +837,7 @@ ReturnedValueMustNotBePrimitive(JSContext *cx, HandleObject proxy, JSAtom *atom, static JSObject * GetIndirectProxyHandlerObject(JSObject *proxy) { - return GetProxyPrivate(proxy).toObjectOrNull(); + return proxy->as().private_().toObjectOrNull(); } bool @@ -1013,7 +1005,7 @@ bool ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedValue call(cx, GetCall(proxy)); + RootedValue call(cx, proxy->as().call()); return Invoke(cx, args.thisv(), call, args.length(), args.array(), args.rval()); } @@ -1021,9 +1013,9 @@ bool ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { assertEnteredPolicy(cx, proxy, JSID_VOID); - RootedValue fval(cx, GetConstruct(proxy)); + RootedValue fval(cx, proxy->as().constructOrUndefined()); if (fval.isUndefined()) - fval = GetCall(proxy); + fval = proxy->as().call(); return InvokeConstructor(cx, fval, args.length(), args.array(), args.rval().address()); } @@ -1038,9 +1030,8 @@ JSString * ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { assertEnteredPolicy(cx, proxy, JSID_VOID); - Value fval = GetCall(proxy); - if (IsFunctionProxy(proxy) && - (fval.isPrimitive() || !fval.toObject().is())) { + Value fval = proxy->as().call(); + if (fval.isPrimitive() || !fval.toObject().is()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, js_Function_str, js_toString_str, @@ -1067,7 +1058,7 @@ ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton; static JSObject * GetDirectProxyHandlerObject(JSObject *proxy) { - return GetProxyExtra(proxy, 0).toObjectOrNull(); + return proxy->as().extra(0).toObjectOrNull(); } /* Derived class for all scripted direct proxy handlers. */ @@ -1355,7 +1346,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -1463,7 +1454,7 @@ TrapDefineOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHan RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -1668,7 +1659,7 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step b - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step c RootedValue trap(cx); @@ -1770,7 +1761,7 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step b - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step c RootedValue trap(cx); @@ -1808,7 +1799,7 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -1860,7 +1851,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdV RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step b - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step c RootedValue trap(cx); @@ -1903,7 +1894,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -1966,7 +1957,7 @@ ScriptedDirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId i RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -2043,7 +2034,7 @@ ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -2112,7 +2103,7 @@ ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step 3 RootedValue trap(cx); @@ -2180,7 +2171,7 @@ ScriptedDirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step b - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); // step c RootedValue trap(cx); @@ -2229,7 +2220,7 @@ ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallAr RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); /* * NB: Remember to throw a TypeError here if we change NewProxyObject so that this trap can get @@ -2267,7 +2258,7 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const C RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); // step 2 - RootedObject target(cx, GetProxyTargetObject(proxy)); + RootedObject target(cx, proxy->as().target()); /* * NB: Remember to throw a TypeError here if we change NewProxyObject so that this trap can get @@ -2315,7 +2306,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc, unsigned flags) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); desc->obj = NULL; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2348,7 +2339,7 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); desc->obj = NULL; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2372,11 +2363,11 @@ bool Proxy::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); - return GetProxyHandler(proxy)->defineProperty(cx, proxy, id, desc); + return proxy->as().handler()->defineProperty(cx, proxy, id, desc); } bool @@ -2392,23 +2383,23 @@ bool Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) return policy.returnValue(); - return GetProxyHandler(proxy)->getOwnPropertyNames(cx, proxy, props); + return proxy->as().handler()->getOwnPropertyNames(cx, proxy, props); } bool Proxy::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); *bp = true; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); - return GetProxyHandler(proxy)->delete_(cx, proxy, id, bp); + return proxy->as().handler()->delete_(cx, proxy, id, bp); } JS_FRIEND_API(bool) @@ -2435,12 +2426,12 @@ bool Proxy::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) return policy.returnValue(); if (!handler->hasPrototype()) - return GetProxyHandler(proxy)->enumerate(cx, proxy, props); + return proxy->as().handler()->enumerate(cx, proxy, props); if (!handler->keys(cx, proxy, props)) return false; AutoIdVector protoProps(cx); @@ -2453,7 +2444,7 @@ bool Proxy::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2474,7 +2465,7 @@ bool Proxy::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2487,7 +2478,7 @@ Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) @@ -2514,7 +2505,7 @@ Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject recei if (!IndexToId(cx, index, &id)) return false; - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2530,7 +2521,7 @@ Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject recei if (hasOwn) { *present = true; - return GetProxyHandler(proxy)->get(cx, proxy, receiver, id, vp); + return proxy->as().handler()->get(cx, proxy, receiver, id, vp); } *present = false; @@ -2543,7 +2534,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2573,7 +2564,7 @@ bool Proxy::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) return policy.returnValue(); @@ -2584,7 +2575,7 @@ bool Proxy::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); vp.setUndefined(); // default result if we refuse to perform this action if (!handler->hasPrototype()) { AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, @@ -2612,14 +2603,14 @@ bool Proxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) { JS_CHECK_RECURSION(cx, return false); - return GetProxyHandler(proxy)->isExtensible(cx, proxy, extensible); + return proxy->as().handler()->isExtensible(cx, proxy, extensible); } bool Proxy::preventExtensions(JSContext *cx, HandleObject proxy) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); return handler->preventExtensions(cx, proxy); } @@ -2627,7 +2618,7 @@ bool Proxy::call(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2646,7 +2637,7 @@ bool Proxy::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); // Because vp[0] is JS_CALLEE on the way in and JS_RVAL on the way out, we // can only set our default value once we're sure that we're not calling the @@ -2669,33 +2660,33 @@ Proxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArg // Note - we don't enter a policy here because our security architecture // guards against nativeCall by overriding the trap itself in the right // circumstances. - return GetProxyHandler(proxy)->nativeCall(cx, test, impl, args); + return proxy->as().handler()->nativeCall(cx, test, impl, args); } bool Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { JS_CHECK_RECURSION(cx, return false); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); *bp = false; // default result if we refuse to perform this action AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, true); if (!policy.allowed()) return policy.returnValue(); - return GetProxyHandler(proxy)->hasInstance(cx, proxy, v, bp); + return proxy->as().handler()->hasInstance(cx, proxy, v, bp); } bool Proxy::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) { JS_CHECK_RECURSION(cx, return false); - return GetProxyHandler(proxy)->objectClassIs(proxy, classValue, cx); + return proxy->as().handler()->objectClassIs(proxy, classValue, cx); } const char * Proxy::className(JSContext *cx, HandleObject proxy) { JS_CHECK_RECURSION(cx, return NULL); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2709,7 +2700,7 @@ JSString * Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) { JS_CHECK_RECURSION(cx, return NULL); - BaseProxyHandler *handler = GetProxyHandler(proxy); + BaseProxyHandler *handler = proxy->as().handler(); AutoEnterPolicy policy(cx, handler, proxy, JS::JSID_VOIDHANDLE, BaseProxyHandler::GET, /* mayThrow = */ false); // Do the safe thing if the policy rejects. @@ -2726,21 +2717,21 @@ bool Proxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) { JS_CHECK_RECURSION(cx, return false); - return GetProxyHandler(proxy)->regexp_toShared(cx, proxy, g); + return proxy->as().handler()->regexp_toShared(cx, proxy, g); } bool Proxy::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) { JS_CHECK_RECURSION(cx, return false); - return GetProxyHandler(proxy)->defaultValue(cx, proxy, hint, vp); + return proxy->as().handler()->defaultValue(cx, proxy, hint, vp); } bool Proxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject proto) { JS_CHECK_RECURSION(cx, return false); - return GetProxyHandler(proxy)->getPrototypeOf(cx, proxy, proto); + return proxy->as().handler()->getPrototypeOf(cx, proxy, proto); } JSObject * const Proxy::LazyProto = reinterpret_cast(0x1); @@ -2748,7 +2739,7 @@ JSObject * const Proxy::LazyProto = reinterpret_cast(0x1); static JSObject * proxy_innerObject(JSContext *cx, HandleObject obj) { - return GetProxyPrivate(obj).toObjectOrNull(); + return obj->as().private_().toObjectOrNull(); } static JSBool @@ -3008,66 +2999,69 @@ proxy_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, JSBool return proxy_DeleteGeneric(cx, obj, id, succeeded); } -static void -proxy_TraceObject(JSTracer *trc, JSObject *obj) +/* static */ void +ProxyObject::trace(JSTracer *trc, JSObject *obj) { + ProxyObject *proxy = &obj->as(); + #ifdef DEBUG - if (!trc->runtime->gcDisableStrictProxyCheckingCount && obj->isWrapper()) { - JSObject *referent = &GetProxyPrivate(obj).toObject(); - if (referent->compartment() != obj->compartment()) { + if (!trc->runtime->gcDisableStrictProxyCheckingCount && proxy->isWrapper()) { + JSObject *referent = &proxy->private_().toObject(); + if (referent->compartment() != proxy->compartment()) { /* * Assert that this proxy is tracked in the wrapper map. We maintain * the invariant that the wrapped object is the key in the wrapper map. */ Value key = ObjectValue(*referent); - WrapperMap::Ptr p = obj->compartment()->lookupWrapper(key); - JS_ASSERT(*p->value.unsafeGet() == ObjectValue(*obj)); + WrapperMap::Ptr p = proxy->compartment()->lookupWrapper(key); + JS_ASSERT(*p->value.unsafeGet() == ObjectValue(*proxy)); } } #endif - // NB: If you add new slots here, make sure to change - // js::NukeChromeCrossCompartmentWrappers to cope. - MarkCrossCompartmentSlot(trc, obj, &obj->getReservedSlotRef(JSSLOT_PROXY_PRIVATE), "private"); - MarkSlot(trc, &obj->getReservedSlotRef(JSSLOT_PROXY_EXTRA + 0), "extra0"); + // Note: If you add new slots here, make sure to change + // nuke() to cope. + MarkCrossCompartmentSlot(trc, obj, proxy->slotOfPrivate(), "private"); + MarkSlot(trc, proxy->slotOfExtra(0), "extra0"); /* * The GC can use the second reserved slot to link the cross compartment * wrappers into a linked list, in which case we don't want to trace it. */ - if (!IsCrossCompartmentWrapper(obj)) - MarkSlot(trc, &obj->getReservedSlotRef(JSSLOT_PROXY_EXTRA + 1), "extra1"); + if (!IsCrossCompartmentWrapper(proxy)) + MarkSlot(trc, proxy->slotOfExtra(1), "extra1"); } static void proxy_TraceFunction(JSTracer *trc, JSObject *obj) { // NB: If you add new slots here, make sure to change - // js::NukeChromeCrossCompartmentWrappers to cope. - MarkCrossCompartmentSlot(trc, obj, &GetCall(obj), "call"); - MarkSlot(trc, &GetFunctionProxyConstruct(obj), "construct"); - proxy_TraceObject(trc, obj); + // nuke() to cope. + FunctionProxyObject *proxy = &obj->as(); + MarkCrossCompartmentSlot(trc, proxy, &proxy->call(), "call"); + MarkSlot(trc, &proxy->construct(), "construct"); + ProxyObject::trace(trc, proxy); } static JSObject * proxy_WeakmapKeyDelegate(JSObject *obj) { - JS_ASSERT(obj->isProxy()); - return GetProxyHandler(obj)->weakmapKeyDelegate(obj); + JS_ASSERT(obj->is()); + return obj->as().handler()->weakmapKeyDelegate(obj); } static JSBool proxy_Convert(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) { - JS_ASSERT(proxy->isProxy()); + JS_ASSERT(proxy->is()); return Proxy::defaultValue(cx, proxy, hint, vp); } static void proxy_Finalize(FreeOp *fop, JSObject *obj) { - JS_ASSERT(obj->isProxy()); - GetProxyHandler(obj)->finalize(fop, obj); + JS_ASSERT(obj->is()); + obj->as().handler()->finalize(fop, obj); } static JSBool @@ -3089,7 +3083,7 @@ proxy_HasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, JSBoo proxy_WeakmapKeyDelegate \ } -JS_FRIEND_DATA(Class) js::ObjectProxyClass = { +Class js::ObjectProxyObject::class_ = { "Proxy", Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4) | JSCLASS_HAS_CACHED_PROTO(JSProto_Proxy), @@ -3105,7 +3099,7 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = { NULL, /* call */ proxy_HasInstance, /* hasInstance */ NULL, /* construct */ - proxy_TraceObject, /* trace */ + ProxyObject::trace, /* trace */ PROXY_CLASS_EXT, { proxy_LookupGeneric, @@ -3141,7 +3135,9 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = { } }; -JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = { +JS_FRIEND_DATA(Class*) js::ObjectProxyClassPtr = &ObjectProxyObject::class_; + +Class js::OuterWindowProxyObject::class_ = { "Proxy", Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4), JS_PropertyStub, /* addProperty */ @@ -3156,7 +3152,7 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = { NULL, /* call */ NULL, /* hasInstance */ NULL, /* construct */ - proxy_TraceObject, /* trace */ + ProxyObject::trace, /* trace */ { NULL, /* outerObject */ proxy_innerObject, @@ -3198,12 +3194,14 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = { } }; +JS_FRIEND_DATA(Class*) js::OuterWindowProxyClassPtr = &OuterWindowProxyObject::class_; + static JSBool proxy_Call(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject proxy(cx, &args.callee()); - JS_ASSERT(proxy->isProxy()); + JS_ASSERT(proxy->is()); return Proxy::call(cx, proxy, args); } @@ -3212,11 +3210,11 @@ proxy_Construct(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject proxy(cx, &args.callee()); - JS_ASSERT(proxy->isProxy()); + JS_ASSERT(proxy->is()); return Proxy::construct(cx, proxy, args); } -JS_FRIEND_DATA(Class) js::FunctionProxyClass = { +Class js::FunctionProxyObject::class_ = { "Proxy", Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(6), JS_PropertyStub, /* addProperty */ @@ -3267,9 +3265,11 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = { } }; -static JSObject * -NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, - JSObject *parent_, ProxyCallable callable) +JS_FRIEND_DATA(Class*) js::FunctionProxyClassPtr = &FunctionProxyObject::class_; + +/* static */ ProxyObject * +ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_, + JSObject *parent_, ProxyCallable callable) { Rooted proto(cx, proto_); RootedObject parent(cx, parent_); @@ -3278,9 +3278,10 @@ NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tagge JS_ASSERT_IF(parent, cx->compartment() == parent->compartment()); Class *clasp; if (callable) - clasp = &FunctionProxyClass; + clasp = &FunctionProxyObject::class_; else - clasp = handler->isOuterWindow() ? &OuterWindowProxyClass : &ObjectProxyClass; + clasp = handler->isOuterWindow() ? &OuterWindowProxyObject::class_ + : &ObjectProxyObject::class_; /* * Eagerly mark properties unknown for proxies, so we don't try to track @@ -3293,72 +3294,85 @@ NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tagge return NULL; } - NewObjectKind newKind = clasp == &OuterWindowProxyClass ? SingletonObject : GenericObject; + NewObjectKind newKind = + clasp == &OuterWindowProxyObject::class_ ? SingletonObject : GenericObject; gc::AllocKind allocKind = gc::GetGCObjectKind(clasp); if (handler->finalizeInBackground(priv)) allocKind = GetBackgroundAllocKind(allocKind); RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind)); if (!obj) return NULL; - obj->initSlot(JSSLOT_PROXY_HANDLER, PrivateValue(handler)); - obj->initCrossCompartmentSlot(JSSLOT_PROXY_PRIVATE, priv); + + Rooted proxy(cx, &obj->as()); + proxy->initHandler(handler); + proxy->initCrossCompartmentPrivate(priv); /* Don't track types of properties of proxies. */ if (newKind != SingletonObject) - MarkTypeObjectUnknownProperties(cx, obj->type()); + MarkTypeObjectUnknownProperties(cx, proxy->type()); - return obj; + return proxy; } JS_FRIEND_API(JSObject *) js::NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, JSObject *parent_, ProxyCallable callable) { - return NewProxyObject(cx, handler, priv, TaggedProto(proto_), parent_, callable); + return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), parent_, callable); } -static JSObject * -NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto_, - JSObject *parent_, JSObject *call_, JSObject *construct_) +static ProxyObject * +NewProxyObject(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, JSObject *proto, + JSObject *parent, JSObject *call, JSObject *construct) { - RootedObject call(cx, call_); - RootedObject construct(cx, construct_); + if (!call && !construct) + return ProxyObject::New(cx, handler, priv, TaggedProto(proto), parent, ProxyNotCallable); + return FunctionProxyObject::New(cx, handler, priv, proto, parent, call, construct); +} + +/* static */ FunctionProxyObject * +FunctionProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, + JSObject *proto, JSObject *parent, JSObject *callArg, + JSObject *constructArg) +{ + RootedObject call(cx, callArg); + RootedObject construct(cx, constructArg); + + JS_ASSERT(call || construct); JS_ASSERT_IF(construct, cx->compartment() == construct->compartment()); JS_ASSERT_IF(call && cx->compartment() != call->compartment(), priv == ObjectValue(*call)); - JSObject *proxy = NewProxyObject(cx, handler, priv, TaggedProto(proto_), parent_, - call || construct ? ProxyIsCallable : ProxyNotCallable); - if (!proxy) + ProxyObject *obj = ProxyObject::New(cx, handler, priv, TaggedProto(proto), parent, + ProxyIsCallable); + if (!obj) return NULL; + FunctionProxyObject *proxy = &obj->as(); if (call) - proxy->initCrossCompartmentSlot(JSSLOT_PROXY_CALL, ObjectValue(*call)); + proxy->initCrossCompartmentSlot(CALL_SLOT, ObjectValue(*call)); if (construct) - proxy->initCrossCompartmentSlot(JSSLOT_PROXY_CONSTRUCT, ObjectValue(*construct)); + proxy->initCrossCompartmentSlot(CONSTRUCT_SLOT, ObjectValue(*construct)); return proxy; } -JSObject * -js::RenewProxyObject(JSContext *cx, JSObject *obj, - BaseProxyHandler *handler, Value priv) +void +ProxyObject::renew(JSContext *cx, BaseProxyHandler *handler, Value priv) { - JS_ASSERT_IF(IsCrossCompartmentWrapper(obj), IsDeadProxyObject(obj)); - JS_ASSERT(obj->getParent() == cx->global()); - JS_ASSERT(obj->getClass() == &ObjectProxyClass); - JS_ASSERT(obj->getTaggedProto().isLazy()); + JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); + JS_ASSERT(getParent() == cx->global()); + JS_ASSERT(getClass() == &ObjectProxyObject::class_); + JS_ASSERT(getTaggedProto().isLazy()); #ifdef DEBUG AutoSuppressGC suppressGC(cx); JS_ASSERT(!handler->isOuterWindow()); #endif - obj->setSlot(JSSLOT_PROXY_HANDLER, PrivateValue(handler)); - obj->setCrossCompartmentSlot(JSSLOT_PROXY_PRIVATE, priv); - obj->setSlot(JSSLOT_PROXY_EXTRA + 0, UndefinedValue()); - obj->setSlot(JSSLOT_PROXY_EXTRA + 1, UndefinedValue()); - - return obj; + setSlot(HANDLER_SLOT, PrivateValue(handler)); + setCrossCompartmentSlot(PRIVATE_SLOT, priv); + setSlot(EXTRA_SLOT + 0, UndefinedValue()); + setSlot(EXTRA_SLOT + 1, UndefinedValue()); } static JSBool @@ -3381,12 +3395,11 @@ proxy(JSContext *cx, unsigned argc, jsval *vp) return false; RootedObject fun(cx, target->isCallable() ? target.get() : (JSObject *) NULL); RootedValue priv(cx, ObjectValue(*target)); - JSObject *proxy = NewProxyObject(cx, &ScriptedDirectProxyHandler::singleton, - priv, proto, cx->global(), - fun, fun); + ProxyObject *proxy = NewProxyObject(cx, &ScriptedDirectProxyHandler::singleton, + priv, proto, cx->global(), fun, fun); if (!proxy) return false; - SetProxyExtra(proxy, 0, ObjectOrNullValue(handler)); + proxy->setExtra(0, ObjectOrNullValue(handler)); vp->setObject(*proxy); return true; } @@ -3482,6 +3495,6 @@ js_InitProxyClass(JSContext *cx, HandleObject obj) return NULL; } - MarkStandardClassInitializedNoProto(obj, &ObjectProxyClass); + MarkStandardClassInitializedNoProto(obj, &ObjectProxyObject::class_); return ctor; } diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 1416584c93d8..56868a05c3ce 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -259,12 +259,17 @@ class Proxy inline bool IsObjectProxyClass(const Class *clasp) { - return clasp == &js::ObjectProxyClass || clasp == &js::OuterWindowProxyClass; + return clasp == js::ObjectProxyClassPtr || clasp == js::OuterWindowProxyClassPtr; } inline bool IsFunctionProxyClass(const Class *clasp) { - return clasp == &js::FunctionProxyClass; + return clasp == js::FunctionProxyClassPtr; +} + +inline bool IsProxyClass(const Class *clasp) +{ + return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); } inline bool IsObjectProxy(JSObject *obj) @@ -279,36 +284,33 @@ inline bool IsFunctionProxy(JSObject *obj) inline bool IsProxy(JSObject *obj) { - Class *clasp = GetObjectClass(obj); - return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); + return IsProxyClass(GetObjectClass(obj)); } -/* Shared between object and function proxies. */ /* - * NOTE: JSSLOT_PROXY_PRIVATE is 0, because that way slot 0 is usable by API + * These are part of the API. + * + * NOTE: PROXY_PRIVATE_SLOT is 0 because that way slot 0 is usable by API * clients for both proxy and non-proxy objects. So an API client that only * needs to store one slot's worth of data doesn't need to branch on what sort * of object it has. */ -const uint32_t JSSLOT_PROXY_PRIVATE = 0; -const uint32_t JSSLOT_PROXY_HANDLER = 1; -const uint32_t JSSLOT_PROXY_EXTRA = 2; -/* Function proxies only. */ -const uint32_t JSSLOT_PROXY_CALL = 4; -const uint32_t JSSLOT_PROXY_CONSTRUCT = 5; +const uint32_t PROXY_PRIVATE_SLOT = 0; +const uint32_t PROXY_HANDLER_SLOT = 1; +const uint32_t PROXY_EXTRA_SLOT = 2; inline BaseProxyHandler * GetProxyHandler(JSObject *obj) { JS_ASSERT(IsProxy(obj)); - return (BaseProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER).toPrivate(); + return (BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); } inline const Value & GetProxyPrivate(JSObject *obj) { JS_ASSERT(IsProxy(obj)); - return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE); + return GetReservedSlot(obj, PROXY_PRIVATE_SLOT); } inline JSObject * @@ -322,14 +324,14 @@ inline const Value & GetProxyExtra(JSObject *obj, size_t n) { JS_ASSERT(IsProxy(obj)); - return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n); + return GetReservedSlot(obj, PROXY_EXTRA_SLOT + n); } inline void SetProxyHandler(JSObject *obj, BaseProxyHandler *handler) { JS_ASSERT(IsProxy(obj)); - SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); + SetReservedSlot(obj, PROXY_HANDLER_SLOT, PrivateValue(handler)); } inline void @@ -337,7 +339,7 @@ SetProxyExtra(JSObject *obj, size_t n, const Value &extra) { JS_ASSERT(IsProxy(obj)); JS_ASSERT(n <= 1); - SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra); + SetReservedSlot(obj, PROXY_EXTRA_SLOT + n, extra); } enum ProxyCallable { diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index 7ab3286acfa5..92a4731ddf27 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -25,7 +25,6 @@ #include "vm/RegExpObject.h" #include "jsobjinlines.h" -#include "jsstrinlines.h" using namespace js; using namespace js::frontend; @@ -314,7 +313,7 @@ class NodeBuilder } bool newObject(MutableHandleObject dst) { - RootedObject nobj(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject nobj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!nobj) return false; @@ -621,7 +620,7 @@ NodeBuilder::newNode(ASTType type, TokenPos *pos, MutableHandleObject dst) JS_ASSERT(type > AST_ERROR && type < AST_LIMIT); RootedValue tv(cx); - RootedObject node(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject node(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!node || !setNodeLoc(node, pos) || !atomValue(nodeTypeNames[type], &tv) || @@ -3081,7 +3080,7 @@ JS_PUBLIC_API(JSObject *) JS_InitReflect(JSContext *cx, JSObject *objArg) { RootedObject obj(cx, objArg); - RootedObject Reflect(cx, NewObjectWithClassProto(cx, &ObjectClass, NULL, obj, SingletonObject)); + RootedObject Reflect(cx, NewObjectWithClassProto(cx, &JSObject::class_, NULL, obj, SingletonObject)); if (!Reflect) return NULL; diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 63c24f7ca23d..8ae579f272eb 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -2445,6 +2445,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, dst->isGeneratorExp = src->isGeneratorExp; /* Copy over hints. */ + dst->shouldInline = src->shouldInline; dst->shouldCloneAtCallsite = src->shouldCloneAtCallsite; dst->isCallsiteClone = src->isCallsiteClone; diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 668c804f2528..23d1dc51d074 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -549,8 +549,8 @@ class JSScript : public js::gc::Cell information can be made context sensitive. See discussion in bug 826148. */ bool shouldCloneAtCallsite:1; - bool isCallsiteClone:1; /* is a callsite clone; has a link to the original function */ + bool shouldInline:1; /* hint to inline when possible */ #ifdef JS_ION bool failedBoundsCheck:1; /* script has had hoisted bounds checks fail */ bool failedShapeGuard:1; /* script has had hoisted shape guard fail */ diff --git a/js/src/jswatchpoint.cpp b/js/src/jswatchpoint.cpp index db9d8a198d35..99806904ef73 100644 --- a/js/src/jswatchpoint.cpp +++ b/js/src/jswatchpoint.cpp @@ -12,7 +12,9 @@ #include "gc/Marking.h" #include "jsgcinlines.h" -#include "jsobjinlines.h" + +#include "gc/Barrier-inl.h" +#include "vm/ObjectImpl-inl.h" using namespace js; using namespace js::gc; diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 6a619bc840e0..c292cfcbef47 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -258,7 +258,8 @@ TryPreserveReflector(JSContext *cx, HandleObject obj) { if (obj->getClass()->ext.isWrappedNative || (obj->getClass()->flags & JSCLASS_IS_DOMJSCLASS) || - (obj->isProxy() && GetProxyHandler(obj)->family() == GetDOMProxyHandlerFamily())) + (obj->is() && + obj->as().handler()->family() == GetDOMProxyHandlerFamily())) { JS_ASSERT(cx->runtime()->preserveWrapperCallback); if (!cx->runtime()->preserveWrapperCallback(cx, obj)) { diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index 5428ed5c0dd7..957bef4b481e 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -47,21 +47,22 @@ JSObject * Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler) { JS_ASSERT(!obj->isCallable()); - return RenewProxyObject(cx, existing, handler, ObjectValue(*obj)); + existing->as().renew(cx, handler, ObjectValue(*obj)); + return existing; } Wrapper * Wrapper::wrapperHandler(JSObject *wrapper) { JS_ASSERT(wrapper->isWrapper()); - return static_cast(GetProxyHandler(wrapper)); + return static_cast(wrapper->as().handler()); } JSObject * Wrapper::wrappedObject(JSObject *wrapper) { JS_ASSERT(wrapper->isWrapper()); - return GetProxyTargetObject(wrapper); + return wrapper->as().target(); } JS_FRIEND_API(JSObject *) @@ -71,7 +72,7 @@ js::UncheckedUnwrap(JSObject *wrapped, bool stopAtOuter, unsigned *flagsp) while (wrapped->isWrapper() && !JS_UNLIKELY(stopAtOuter && wrapped->getClass()->ext.innerObject)) { flags |= Wrapper::wrapperHandler(wrapped)->flags(); - wrapped = GetProxyPrivate(wrapped).toObjectOrNull(); + wrapped = wrapped->as().private_().toObjectOrNull(); } if (flagsp) *flagsp = flags; @@ -836,20 +837,8 @@ js::NewDeadProxyObject(JSContext *cx, JSObject *parent) bool js::IsDeadProxyObject(JSObject *obj) { - return IsProxy(obj) && GetProxyHandler(obj) == &DeadObjectProxy::singleton; -} - -static void -NukeSlot(JSObject *wrapper, uint32_t slot, Value v) -{ - Value old = wrapper->getSlot(slot); - if (old.isMarkable()) { - Zone *zone = ZoneOfValue(old); - AutoMarkInDeadZone amd(zone); - wrapper->setReservedSlot(slot, v); - } else { - wrapper->setReservedSlot(slot, v); - } + return obj->is() && + obj->as().handler() == &DeadObjectProxy::singleton; } void @@ -859,16 +848,7 @@ js::NukeCrossCompartmentWrapper(JSContext *cx, JSObject *wrapper) NotifyGCNukeWrapper(wrapper); - NukeSlot(wrapper, JSSLOT_PROXY_PRIVATE, NullValue()); - SetProxyHandler(wrapper, &DeadObjectProxy::singleton); - - if (IsFunctionProxy(wrapper)) { - NukeSlot(wrapper, JSSLOT_PROXY_CALL, NullValue()); - NukeSlot(wrapper, JSSLOT_PROXY_CONSTRUCT, NullValue()); - } - - NukeSlot(wrapper, JSSLOT_PROXY_EXTRA + 0, NullValue()); - NukeSlot(wrapper, JSSLOT_PROXY_EXTRA + 1, NullValue()); + wrapper->as().nuke(&DeadObjectProxy::singleton); JS_ASSERT(IsDeadProxyObject(wrapper)); } diff --git a/js/src/moz.build b/js/src/moz.build index 94e584b20d2e..f412f875b795 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -112,6 +112,7 @@ CPP_SOURCES += [ 'Probes.cpp', 'Profilers.cpp', 'PropertyKey.cpp', + 'ProxyObject.cpp', 'RegExp.cpp', 'RegExpObject.cpp', 'RegExpStatics.cpp', diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 2e4e436197c0..3ae130f0cf77 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -2685,7 +2685,7 @@ CopyProperty(JSContext *cx, HandleObject obj, HandleObject referent, HandleId id desc.setter = JS_StrictPropertyStub; desc.shortid = shape->shortid(); propFlags = shape->getFlags(); - } else if (IsProxy(referent)) { + } else if (referent->is()) { if (!Proxy::getOwnPropertyDescriptor(cx, referent, id, &desc, 0)) return false; if (!desc.obj) @@ -5281,7 +5281,7 @@ main(int argc, char **argv, char **envp) "Don't compile very large scripts (default: on, off to disable)") || !op.addIntOption('\0', "ion-uses-before-compile", "COUNT", "Wait for COUNT calls or iterations before compiling " - "(default: 10240)", -1) + "(default: 1000)", -1) || !op.addStringOption('\0', "ion-regalloc", "[mode]", "Specify Ion register allocation:\n" " lsra: Linear Scan register allocation (default)\n" diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 7f63f050f99f..a907b5e81a0b 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -832,7 +832,7 @@ Debugger::newCompletionValue(JSContext *cx, JSTrapStatus status, Value value_, } /* Common tail for JSTRAP_RETURN and JSTRAP_THROW. */ - RootedObject obj(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!obj || !wrapDebuggeeValue(cx, &value) || !DefineNativeProperty(cx, obj, key, value, JS_PropertyStub, JS_StrictPropertyStub, @@ -883,7 +883,7 @@ Debugger::parseResumptionValue(Maybe &ac, bool ok, const Value bool okResumption = rv.isObject(); if (okResumption) { obj = &rv.toObject(); - okResumption = obj->isObject(); + okResumption = obj->is(); } if (okResumption) { shape = obj->lastProperty(); @@ -2099,7 +2099,8 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp) /* Add the initial debuggees, if any. */ for (unsigned i = 0; i < argc; i++) { - Rooted debuggee(cx, &GetProxyPrivate(&args[i].toObject()).toObject().global()); + Rooted + debuggee(cx, &args[i].toObject().as().private_().toObject().global()); if (!dbg->addDebuggeeGlobal(cx, debuggee)) return false; } @@ -3273,7 +3274,7 @@ DebuggerScript_getAllColumnOffsets(JSContext *cx, unsigned argc, Value *vp) if (!flowData[offset].hasNoEdges() && (flowData[offset].lineno() != lineno || flowData[offset].column() != column)) { - RootedObject entry(cx, NewBuiltinClassInstance(cx, &ObjectClass)); + RootedObject entry(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!entry) return false; @@ -4205,7 +4206,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, /* If evalWithBindings, create the inner environment. */ if (bindings) { /* TODO - This should probably be a Call object, like ES5 strict eval. */ - env = NewObjectWithGivenProto(cx, &ObjectClass, NULL, env); + env = NewObjectWithGivenProto(cx, &JSObject::class_, NULL, env); if (!env) return false; RootedId id(cx); diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 94772438d5de..c0075d4b17bd 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -101,7 +101,7 @@ TestProtoSetterThis(const Value &v) return true; /* Otherwise, only accept non-proxies. */ - return !v.toObject().isProxy(); + return !v.toObject().is(); } static bool @@ -138,10 +138,10 @@ ProtoSetterImpl(JSContext *cx, CallArgs args) * which due to their complicated delegate-object shenanigans can't easily * have a mutable [[Prototype]]. */ - if (obj->isProxy() || obj->is()) { + if (obj->is() || obj->is()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, "Object", "__proto__ setter", - obj->isProxy() ? "Proxy" : "ArrayBuffer"); + obj->is() ? "Proxy" : "ArrayBuffer"); return false; } @@ -189,7 +189,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx) * Create |Object.prototype| first, mirroring CreateBlankProto but for the * prototype of the created object. */ - objectProto = NewObjectWithGivenProto(cx, &ObjectClass, NULL, self, SingletonObject); + objectProto = NewObjectWithGivenProto(cx, &JSObject::class_, NULL, self, SingletonObject); if (!objectProto) return NULL; @@ -198,7 +198,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx) * to have unknown properties, to simplify handling of e.g. heterogenous * objects in JSON and script literals. */ - if (!setNewTypeUnknown(cx, &ObjectClass, objectProto)) + if (!setNewTypeUnknown(cx, &JSObject::class_, objectProto)) return NULL; /* Create |Function.prototype| next so we can create other functions. */ @@ -384,7 +384,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx) if (cx->runtime()->isSelfHostingGlobal(self)) { intrinsicsHolder = self; } else { - intrinsicsHolder = NewObjectWithClassProto(cx, &ObjectClass, NULL, self, TenuredObject); + intrinsicsHolder = NewObjectWithClassProto(cx, &JSObject::class_, NULL, self, TenuredObject); if (!intrinsicsHolder) return NULL; } @@ -512,7 +512,7 @@ GlobalObject::createConstructor(JSContext *cx, Native ctor, JSAtom *nameArg, uns static JSObject * CreateBlankProto(JSContext *cx, Class *clasp, JSObject &proto, GlobalObject &global) { - JS_ASSERT(clasp != &ObjectClass); + JS_ASSERT(clasp != &JSObject::class_); JS_ASSERT(clasp != &JSFunction::class_); RootedObject blankProto(cx, NewObjectWithGivenProto(cx, clasp, &proto, &global, SingletonObject)); diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 533aa5771e5d..874296aae184 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -39,7 +39,6 @@ #include "jsatominlines.h" #include "jsboolinlines.h" #include "jsinferinlines.h" -#include "jsopcodeinlines.h" #include "jsscriptinlines.h" #include "builtin/Iterator-inl.h" @@ -2949,8 +2948,8 @@ BEGIN_CASE(JSOP_NEWINIT) obj = NewDenseEmptyArray(cx, NULL, newKind); } else { gc::AllocKind allocKind = GuessObjectGCKind(0); - newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ObjectClass); - obj = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind); + newKind = UseNewTypeForInitializer(cx, script, regs.pc, &JSObject::class_); + obj = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind); } if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind)) goto error; @@ -3008,7 +3007,7 @@ BEGIN_CASE(JSOP_INITPROP) /* Load the object being initialized into lval/obj. */ RootedObject &obj = rootObject0; obj = ®s.sp[-2].toObject(); - JS_ASSERT(obj->isObject()); + JS_ASSERT(obj->is()); PropertyName *name = script->getName(regs.pc); diff --git a/js/src/vm/ObjectImpl-inl.h b/js/src/vm/ObjectImpl-inl.h index 80eb6e277341..5e2b522d4096 100644 --- a/js/src/vm/ObjectImpl-inl.h +++ b/js/src/vm/ObjectImpl-inl.h @@ -19,6 +19,9 @@ #include "vm/ObjectImpl.h" #include "gc/Barrier-inl.h" +#include "vm/Interpreter.h" +#include "vm/ObjectImpl.h" +#include "vm/ProxyObject.h" inline JSCompartment * js::ObjectImpl::compartment() const @@ -41,7 +44,7 @@ js::ObjectImpl::nativeContainsPure(Shape *shape) inline bool js::ObjectImpl::nonProxyIsExtensible() const { - MOZ_ASSERT(!isProxy()); + MOZ_ASSERT(!asObjectPtr()->is()); // [[Extensible]] for ordinary non-proxy objects is an object flag. return !lastProperty()->hasObjectFlag(BaseShape::NOT_EXTENSIBLE); @@ -50,7 +53,7 @@ js::ObjectImpl::nonProxyIsExtensible() const /* static */ inline bool js::ObjectImpl::isExtensible(ExclusiveContext *cx, js::Handle obj, bool *extensible) { - if (obj->isProxy()) { + if (obj->asObjectPtr()->is()) { HandleObject h = HandleObject::fromMarkedLocation(reinterpret_cast(obj.address())); return Proxy::isExtensible(cx->asJSContext(), h, extensible); @@ -66,12 +69,6 @@ js::ObjectImpl::isNative() const return lastProperty()->isNative(); } -inline bool -js::ObjectImpl::isProxy() const -{ - return js::IsProxy(const_cast(this->asObjectPtr())); -} - #ifdef DEBUG inline bool IsObjectValueInCompartment(js::Value v, JSCompartment *comp) @@ -232,6 +229,22 @@ js::ObjectImpl::writeBarrierPost(ObjectImpl *obj, void *addr) #endif } +/* static */ inline void +js::ObjectImpl::writeBarrierPostRelocate(ObjectImpl *obj, void *addr) +{ +#ifdef JSGC_GENERATIONAL + obj->runtime()->gcStoreBuffer.putRelocatableCell((Cell **)addr); +#endif +} + +/* static */ inline void +js::ObjectImpl::writeBarrierPostRemove(ObjectImpl *obj, void *addr) +{ +#ifdef JSGC_GENERATIONAL + obj->runtime()->gcStoreBuffer.removeRelocatableCell((Cell **)addr); +#endif +} + inline void js::ObjectImpl::setPrivate(void *data) { diff --git a/js/src/vm/ObjectImpl.cpp b/js/src/vm/ObjectImpl.cpp index e02a2a83d2af..6a4fb8c49427 100644 --- a/js/src/vm/ObjectImpl.cpp +++ b/js/src/vm/ObjectImpl.cpp @@ -156,7 +156,7 @@ PropDesc::wrapInto(JSContext *cx, HandleObject obj, const jsid &id, jsid *wrappe desc->value_ = value; desc->get_ = get; desc->set_ = set; - return !obj->isProxy() || desc->makeObject(cx); + return !obj->is() || desc->makeObject(cx); } static ObjectElements emptyElementsHeader(0, 0); @@ -524,7 +524,7 @@ js::ArrayBufferDelegate(JSContext *cx, Handle obj) MOZ_ASSERT(obj->hasClass(&ArrayBufferObject::class_)); if (obj->getPrivate()) return static_cast(obj->getPrivate()); - JSObject *delegate = NewObjectWithGivenProto(cx, &ObjectClass, obj->getProto(), NULL); + JSObject *delegate = NewObjectWithGivenProto(cx, &JSObject::class_, obj->getProto(), NULL); obj->setPrivateGCThing(delegate); return delegate; } @@ -568,9 +568,8 @@ js::GetOwnProperty(JSContext *cx, Handle obj, PropertyId pid_, unsi Rooted pid(cx, pid_); - if (static_cast(obj.get())->isProxy()) { + if (Downcast(obj)->is()) MOZ_ASSUME_UNREACHABLE("NYI: proxy [[GetOwnProperty]]"); - } RootedShape shape(cx, obj->nativeLookup(cx, pid)); if (!shape) { @@ -662,9 +661,8 @@ js::GetProperty(JSContext *cx, Handle obj, Handle rece do { MOZ_ASSERT(obj); - if (Downcast(current)->isProxy()) { + if (Downcast(current)->is()) MOZ_ASSUME_UNREACHABLE("NYI: proxy [[GetP]]"); - } AutoPropDescRooter desc(cx); if (!GetOwnProperty(cx, current, pid, resolveFlags, &desc.getPropDesc())) @@ -725,9 +723,8 @@ js::GetElement(JSContext *cx, Handle obj, Handle recei do { MOZ_ASSERT(current); - if (Downcast(current)->isProxy()) { + if (Downcast(current)->is()) MOZ_ASSUME_UNREACHABLE("NYI: proxy [[GetP]]"); - } PropDesc desc; if (!GetOwnElement(cx, current, index, resolveFlags, &desc)) @@ -788,9 +785,8 @@ js::HasElement(JSContext *cx, Handle obj, uint32_t index, unsigned do { MOZ_ASSERT(current); - if (Downcast(current)->isProxy()) { + if (Downcast(current)->is()) MOZ_ASSUME_UNREACHABLE("NYI: proxy [[HasProperty]]"); - } PropDesc prop; if (!GetOwnElement(cx, current, index, resolveFlags, &prop)) @@ -952,9 +948,8 @@ js::SetElement(JSContext *cx, Handle obj, Handle recei do { MOZ_ASSERT(current); - if (Downcast(current)->isProxy()) { + if (Downcast(current)->is()) MOZ_ASSUME_UNREACHABLE("NYI: proxy [[SetP]]"); - } PropDesc ownDesc; if (!GetOwnElement(cx, current, index, resolveFlags, &ownDesc)) diff --git a/js/src/vm/ObjectImpl.h b/js/src/vm/ObjectImpl.h index 28731cd3212b..9d6b0399c44b 100644 --- a/js/src/vm/ObjectImpl.h +++ b/js/src/vm/ObjectImpl.h @@ -1282,8 +1282,6 @@ class ObjectImpl : public gc::Cell MOZ_ASSUME_UNREACHABLE("NYI"); } - inline bool isProxy() const; - protected: #ifdef DEBUG void checkShapeConsistency(); @@ -1655,6 +1653,8 @@ class ObjectImpl : public gc::Cell static inline void readBarrier(ObjectImpl *obj); static inline void writeBarrierPre(ObjectImpl *obj); static inline void writeBarrierPost(ObjectImpl *obj, void *addr); + static inline void writeBarrierPostRelocate(ObjectImpl *obj, void *addr); + static inline void writeBarrierPostRemove(ObjectImpl *obj, void *addr); inline void privateWriteBarrierPre(void **oldval); inline void privateWriteBarrierPost(void **pprivate); void markChildren(JSTracer *trc); diff --git a/js/src/vm/PropertyKey.cpp b/js/src/vm/PropertyKey.cpp index 02e33eb3b273..3da5c2b7f1d9 100644 --- a/js/src/vm/PropertyKey.cpp +++ b/js/src/vm/PropertyKey.cpp @@ -12,8 +12,6 @@ #include "js/Value.h" #include "vm/String.h" -#include "jsatominlines.h" - #include "vm/String-inl.h" using namespace js; diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp new file mode 100644 index 000000000000..8ed37f860d18 --- /dev/null +++ b/js/src/vm/ProxyObject.cpp @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 "vm/ProxyObject.h" + +#include "jsgcinlines.h" +#include "jsobjinlines.h" + +#include "gc/Barrier-inl.h" +#include "vm/ObjectImpl-inl.h" + +using namespace js; + +void +ProxyObject::initCrossCompartmentPrivate(HandleValue priv) +{ + initCrossCompartmentSlot(PRIVATE_SLOT, priv); +} + +void +ProxyObject::initHandler(BaseProxyHandler *handler) +{ + initSlot(HANDLER_SLOT, PrivateValue(handler)); +} + +static void +NukeSlot(ProxyObject *proxy, uint32_t slot) +{ + Value old = proxy->getSlot(slot); + if (old.isMarkable()) { + Zone *zone = ZoneOfValue(old); + AutoMarkInDeadZone amd(zone); + proxy->setReservedSlot(slot, NullValue()); + } else { + proxy->setReservedSlot(slot, NullValue()); + } +} + +void +ProxyObject::nuke(BaseProxyHandler *handler) +{ + NukeSlot(this, PRIVATE_SLOT); + setHandler(handler); + + NukeSlot(this, EXTRA_SLOT + 0); + NukeSlot(this, EXTRA_SLOT + 1); + + if (is()) + as().nukeExtra(); +} + +void +FunctionProxyObject::nukeExtra() +{ + NukeSlot(this, CALL_SLOT); + NukeSlot(this, CONSTRUCT_SLOT); +} diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h new file mode 100644 index 000000000000..c939d4ace32f --- /dev/null +++ b/js/src/vm/ProxyObject.h @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 vm_ProxyObject_h +#define vm_ProxyObject_h + +#include "jsobj.h" +#include "jsproxy.h" + +namespace js { + +// This is the base class for the various kinds of proxy objects. It's never +// instantiated. +class ProxyObject : public JSObject +{ + // These are just local renamings of the slot constants that are part of + // the API in jsproxy.h. + static const uint32_t PRIVATE_SLOT = PROXY_PRIVATE_SLOT; + static const uint32_t HANDLER_SLOT = PROXY_HANDLER_SLOT; + static const uint32_t EXTRA_SLOT = PROXY_EXTRA_SLOT; + + public: + static ProxyObject *New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, + TaggedProto proto_, JSObject *parent_, ProxyCallable callable); + + const Value &private_() { + return GetReservedSlot(this, PRIVATE_SLOT); + } + + void initCrossCompartmentPrivate(HandleValue priv); + + HeapSlot *slotOfPrivate() { + return &getReservedSlotRef(PRIVATE_SLOT); + } + + JSObject *target() const { + return const_cast(this)->private_().toObjectOrNull(); + } + + BaseProxyHandler *handler() { + return static_cast(GetReservedSlot(this, HANDLER_SLOT).toPrivate()); + } + + void initHandler(BaseProxyHandler *handler); + + void setHandler(BaseProxyHandler *handler) { + SetReservedSlot(this, HANDLER_SLOT, PrivateValue(handler)); + } + + static size_t offsetOfHandler() { + return getFixedSlotOffset(HANDLER_SLOT); + } + + const Value &extra(size_t n) const { + JS_ASSERT(n == 0 || n == 1); + return GetReservedSlot(const_cast(this), EXTRA_SLOT + n); + } + + void setExtra(size_t n, const Value &extra) { + JS_ASSERT(n == 0 || n == 1); + SetReservedSlot(this, EXTRA_SLOT + n, extra); + } + + private: + HeapSlot *slotOfExtra(size_t n) { + JS_ASSERT(n == 0 || n == 1); + return &getReservedSlotRef(EXTRA_SLOT + n); + } + + public: + static unsigned grayLinkSlot(JSObject *obj); + + void renew(JSContext *cx, BaseProxyHandler *handler, Value priv); + + static void trace(JSTracer *trc, JSObject *obj); + + void nuke(BaseProxyHandler *handler); +}; + +class FunctionProxyObject : public ProxyObject +{ + static const uint32_t CALL_SLOT = 4; + static const uint32_t CONSTRUCT_SLOT = 5; + + public: + static Class class_; + + static FunctionProxyObject *New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, + JSObject *proto, JSObject *parent, JSObject *call, + JSObject *construct); + + HeapSlot &call() { return getSlotRef(CALL_SLOT); } + + inline HeapSlot &construct(); + inline Value constructOrUndefined() const; + + void nukeExtra(); +}; + +class ObjectProxyObject : public ProxyObject +{ + public: + static Class class_; +}; + +class OuterWindowProxyObject : public ObjectProxyObject +{ + public: + static Class class_; +}; + +} // namespace js + +// Note: the following |JSObject::is| methods are implemented in terms of +// the Is*Proxy() friend API functions to ensure the implementations are tied +// together. The exception is |JSObject::is() +// const|, which uses the standard template definition, because there is no +// IsOuterWindowProxy() function in the friend API. + +template<> +inline bool +JSObject::is() const +{ + return js::IsProxy(const_cast(this)); +} + +template<> +inline bool +JSObject::is() const +{ + return js::IsFunctionProxy(const_cast(this)); +} + +// WARNING: This function succeeds for ObjectProxyObject *and* +// OuterWindowProxyObject (which is a sub-class). If you want a test that only +// succeeds for ObjectProxyObject, use |hasClass(&ObjectProxyObject::class_)|. +template<> +inline bool +JSObject::is() const +{ + return js::IsObjectProxy(const_cast(this)); +} + +#endif /* vm_ProxyObject_h */ diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 40fcf9de66c7..a292fd38e29a 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -10,6 +10,7 @@ #include "jsiter.h" #include "vm/GlobalObject.h" +#include "vm/ProxyObject.h" #include "vm/ScopeObject.h" #include "vm/Shape.h" #include "vm/Xdr.h" @@ -1548,36 +1549,38 @@ DebugScopeObject::create(JSContext *cx, ScopeObject &scope, HandleObject enclosi return NULL; JS_ASSERT(!enclosing->is()); - SetProxyExtra(obj, ENCLOSING_EXTRA, ObjectValue(*enclosing)); - SetProxyExtra(obj, SNAPSHOT_EXTRA, NullValue()); - return &obj->as(); + DebugScopeObject *debugScope = &obj->as(); + debugScope->setExtra(ENCLOSING_EXTRA, ObjectValue(*enclosing)); + debugScope->setExtra(SNAPSHOT_EXTRA, NullValue()); + + return debugScope; } ScopeObject & DebugScopeObject::scope() const { - return GetProxyTargetObject(const_cast(this))->as(); + return target()->as(); } JSObject & DebugScopeObject::enclosingScope() const { - return GetProxyExtra(const_cast(this), ENCLOSING_EXTRA).toObject(); + return extra(ENCLOSING_EXTRA).toObject(); } JSObject * DebugScopeObject::maybeSnapshot() const { JS_ASSERT(!scope().as().isForEval()); - return GetProxyExtra(const_cast(this), SNAPSHOT_EXTRA).toObjectOrNull(); + return extra(SNAPSHOT_EXTRA).toObjectOrNull(); } void DebugScopeObject::initSnapshot(JSObject &o) { JS_ASSERT(maybeSnapshot() == NULL); - SetProxyExtra(this, SNAPSHOT_EXTRA, ObjectValue(o)); + setExtra(SNAPSHOT_EXTRA, ObjectValue(o)); } bool @@ -1588,10 +1591,10 @@ DebugScopeObject::isForDeclarative() const } bool -js_IsDebugScopeSlow(JSObject *obj) +js_IsDebugScopeSlow(ObjectProxyObject *proxy) { - return obj->getClass() == &ObjectProxyClass && - GetProxyHandler(obj) == &DebugScopeProxy::singleton; + JS_ASSERT(proxy->hasClass(&ObjectProxyObject::class_)); + return proxy->handler() == &DebugScopeProxy::singleton; } /*****************************************************************************/ diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index 025c972d0a45..5a395de1d598 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -12,6 +12,7 @@ #include "jsweakmap.h" #include "gc/Barrier.h" +#include "vm/ProxyObject.h" namespace js { @@ -587,7 +588,7 @@ extern JSObject * GetDebugScopeForFrame(JSContext *cx, AbstractFramePtr frame); /* Provides debugger access to a scope. */ -class DebugScopeObject : public JSObject +class DebugScopeObject : public ObjectProxyObject { /* * The enclosing scope on the dynamic scope chain. This slot is analogous @@ -699,8 +700,11 @@ template<> inline bool JSObject::is() const { - extern bool js_IsDebugScopeSlow(JSObject *obj); - return getClass() == &js::ObjectProxyClass && js_IsDebugScopeSlow(const_cast(this)); + extern bool js_IsDebugScopeSlow(js::ObjectProxyObject *proxy); + + // Note: don't use is() here -- it also matches subclasses! + return hasClass(&js::ObjectProxyObject::class_) && + js_IsDebugScopeSlow(&const_cast(this)->as()); } template<> diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index ca15c6f2766f..1260f361dd2d 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -283,6 +283,8 @@ intrinsic_DecompileArg(JSContext *cx, unsigned argc, Value *vp) * - |cloneAtCallsite: true| will hint that |fun| should be cloned * each callsite to improve TI resolution. This is important for * higher-order functions like |Array.map|. + * - |inline: true| will hint that |fun| be inlined regardless of + * JIT heuristics. */ static JSBool intrinsic_SetScriptHints(JSContext *cx, unsigned argc, Value *vp) @@ -305,6 +307,12 @@ intrinsic_SetScriptHints(JSContext *cx, unsigned argc, Value *vp) if (ToBoolean(propv)) funScript->shouldCloneAtCallsite = true; + id = AtomToId(Atomize(cx, "inline", strlen("inline"))); + if (!JSObject::getGeneric(cx, flags, flags, id, &propv)) + return false; + if (ToBoolean(propv)) + funScript->shouldInline = true; + args.rval().setUndefined(); return true; } diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index bdf4a3c3d770..10a32213d5f4 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -1093,7 +1093,7 @@ js::ObjectImpl::preventExtensions(JSContext *cx, Handle obj) "preventExtensions"); #endif - if (obj->isProxy()) { + if (Downcast(obj)->is()) { RootedObject object(cx, obj->asObjectPtr()); return js::Proxy::preventExtensions(cx, object); } diff --git a/js/src/vm/String-inl.h b/js/src/vm/String-inl.h index 273f7cedc90b..67796ca87289 100644 --- a/js/src/vm/String-inl.h +++ b/js/src/vm/String-inl.h @@ -116,11 +116,6 @@ JSString::writeBarrierPre(JSString *str) #endif } -inline void -JSString::writeBarrierPost(JSString *str, void *addr) -{ -} - inline bool JSString::needWriteBarrierPre(JS::Zone *zone) { diff --git a/js/src/vm/String.h b/js/src/vm/String.h index c17773e848d6..5ada721df7d6 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -431,7 +431,9 @@ class JSString : public js::gc::Cell js::gc::AllocKind getAllocKind() const { return tenuredGetAllocKind(); } static inline void writeBarrierPre(JSString *str); - static inline void writeBarrierPost(JSString *str, void *addr); + static void writeBarrierPost(JSString *str, void *addr) {} + static void writeBarrierPostRelocate(JSString *str, void *addr) {} + static void writeBarrierPostRemove(JSString *str, void *addr) {} static inline bool needWriteBarrierPre(JS::Zone *zone); static inline void readBarrier(JSString *str); diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index df1dfbc14ec0..bdd1aaf790ef 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -1333,9 +1333,11 @@ ArrayBufferViewObject::trace(JSTracer *trc, JSObject *obj) MarkSlot(trc, &bufSlot, "typedarray.buffer"); /* Update obj's data slot if the array buffer moved. */ - ArrayBufferObject &buf = bufSlot.toObject().as(); - int32_t offset = obj->getReservedSlot(BYTEOFFSET_SLOT).toInt32(); - obj->initPrivate(buf.dataPointer() + offset); + if (bufSlot.isObject()) { + ArrayBufferObject &buf = bufSlot.toObject().as(); + int32_t offset = obj->getReservedSlot(BYTEOFFSET_SLOT).toInt32(); + obj->initPrivate(buf.dataPointer() + offset); + } /* Update NEXT_VEIW_SLOT, if the view moved. */ IsSlotMarked(&obj->getReservedSlotRef(NEXT_VIEW_SLOT)); @@ -2138,8 +2140,8 @@ class TypedArrayObjectTemplate : public TypedArrayObject return NULL; // must be arrayBuffer } - JS_ASSERT(bufobj->is() || bufobj->isProxy()); - if (bufobj->isProxy()) { + JS_ASSERT(bufobj->is() || bufobj->is()); + if (bufobj->is()) { /* * Normally, NonGenericMethodGuard handles the case of transparent * wrappers. However, we have a peculiar situation: we want to diff --git a/js/xpconnect/loader/Makefile.in b/js/xpconnect/loader/Makefile.in index 6b5e2eb92400..d0fabaabdb7e 100644 --- a/js/xpconnect/loader/Makefile.in +++ b/js/xpconnect/loader/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk FAIL_ON_WARNINGS := 1 MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES += \ -I$(srcdir)/../src \ diff --git a/js/xpconnect/src/Makefile.in b/js/xpconnect/src/Makefile.in index 6bc24a0181a6..3311972c5fa1 100644 --- a/js/xpconnect/src/Makefile.in +++ b/js/xpconnect/src/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpconnect_s MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/js/xpconnect/wrappers/Makefile.in b/js/xpconnect/wrappers/Makefile.in index 532a60f25ee1..d14718b6e3a5 100644 --- a/js/xpconnect/wrappers/Makefile.in +++ b/js/xpconnect/wrappers/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 ifndef _MSC_VER # warning C4661 for FilteringWrapper FAIL_ON_WARNINGS := 1 diff --git a/layout/base/Makefile.in b/layout/base/Makefile.in index c6b973ff9175..2eb3cf37b366 100644 --- a/layout/base/Makefile.in +++ b/layout/base/Makefile.in @@ -15,8 +15,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index d631f9560be7..777ad6b2ee0a 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3518,7 +3518,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt // descendants. nsIContent* parent = content->GetParent(); bool pushInsertionPoint = aState.mTreeMatchContext.mAncestorFilter.HasFilter() && - parent && parent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL); + parent && parent->IsActiveChildrenElement(); TreeMatchContext::AutoAncestorPusher insertionPointPusher(pushInsertionPoint, aState.mTreeMatchContext, @@ -6511,7 +6511,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer, nsIFrame* parentFrame = GetFrameFor(aContainer); // See comment in ContentRangeInserted for why this is necessary. - if (!parentFrame && !aContainer->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + if (!parentFrame && !aContainer->IsActiveChildrenElement()) { return NS_OK; } @@ -6934,7 +6934,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer, // The xbl:children element won't have a frame, but default content can have the children as // a parent. While its uncommon to change the structure of the default content itself, a label, // for example, can be reframed by having its value attribute set or removed. - if (!parentFrame && !aContainer->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + if (!parentFrame && !aContainer->IsActiveChildrenElement()) { return NS_OK; } @@ -8194,7 +8194,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList) NS_ASSERTION(frame, "This shouldn't happen"); if ((frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) && - (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + (frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { // frame does not maintain overflow rects, so avoid calling // FinishAndStoreOverflow on it: hint = NS_SubtractHint(hint, diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index a61fbdcbf465..e23efc50826b 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -1379,8 +1379,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, // children element. Push the children element as an ancestor here because it does // not have a frame and would not otherwise be pushed as an ancestor. nsIContent* parent = undisplayed->mContent->GetParent(); - bool pushInsertionPoint = parent && - parent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL); + bool pushInsertionPoint = parent && parent->IsActiveChildrenElement(); TreeMatchContext::AutoAncestorPusher insertionPointPusher(pushInsertionPoint, aTreeMatchContext, @@ -1549,8 +1548,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext, // Check if the frame has a content because |child| may be a nsPageFrame that does // not have a content. nsIContent* parent = child->GetContent() ? child->GetContent()->GetParent() : nullptr; - bool pushInsertionPoint = parent && - parent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL); + bool pushInsertionPoint = parent && parent->IsActiveChildrenElement(); TreeMatchContext::AutoAncestorPusher insertionPointPusher(pushInsertionPoint, aTreeMatchContext, parent && parent->IsElement() ? parent->AsElement() : nullptr); @@ -1911,8 +1909,7 @@ nsFrameManagerBase::UndisplayedMap::GetEntryFor(nsIContent** aParentContent) // be a element) but the parent in the frame tree would be the // insertion parent (parent of the element). Here the children // elements are normalized to the insertion parent to correct for the mismatch. - if (parentContent && - parentContent->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) { + if (parentContent && parentContent->IsActiveChildrenElement()) { parentContent = parentContent->GetParent(); // Change the caller's pointer for the parent content to be the insertion parent. *aParentContent = parentContent; diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index a84ec76fd6fe..8a6e1290b2fa 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -69,7 +69,7 @@ SHARED_LIBRARY_LIBS = \ $(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/audiochannel/$(LIB_PREFIX)domaudiochannel_s.$(LIB_SUFFIX) \ - $(DEPTH)/dom/future/$(LIB_PREFIX)domfuture_s.$(LIB_SUFFIX) \ + $(DEPTH)/dom/promise/$(LIB_PREFIX)dompromise_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/src/notification/$(LIB_PREFIX)jsdomnotification_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/system/$(LIB_PREFIX)domsystem_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/workers/$(LIB_PREFIX)domworkers_s.$(LIB_SUFFIX) \ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 817b29aed6b3..edd35c00b84e 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -1141,7 +1141,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID }, { "@mozilla.org/content/canvas-rendering-context;1?id=moz-webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID }, { "@mozilla.org/content/canvas-rendering-context;1?id=experimental-webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID }, -#ifdef MOZ_PHOENIX // Not MOZ_FENNEC or MOZ_B2G yet. +#ifdef MOZ_WEBGL_CONFORMANT { "@mozilla.org/content/canvas-rendering-context;1?id=webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID }, #endif { NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", &kNS_TEXT_ENCODER_CID }, diff --git a/layout/forms/Makefile.in b/layout/forms/Makefile.in index b1876bc6ab29..309a08882b5c 100644 --- a/layout/forms/Makefile.in +++ b/layout/forms/Makefile.in @@ -14,9 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index f10d4bcd69ee..5f5daa35c0d7 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -20,8 +20,6 @@ RESOURCES_HTML = \ $(srcdir)/folder.png \ $(NULL) -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index f474378c4599..bfd96d076db8 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -1957,35 +1957,31 @@ nsFlexContainerFrame::ComputeFlexContainerMainSize( const FlexboxAxisTracker& aAxisTracker, const nsTArray& aItems) { - // If we've got a finite computed main-size, use that. - nscoord mainSize = - aAxisTracker.GetMainComponent(nsSize(aReflowState.ComputedWidth(), - aReflowState.ComputedHeight())); - if (mainSize != NS_UNCONSTRAINEDSIZE) { - return mainSize; + if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) { + // Horizontal case is easy -- our main size is our computed width + // (which is already resolved). + return aReflowState.ComputedWidth(); } - NS_WARN_IF_FALSE(!IsAxisHorizontal(aAxisTracker.GetMainAxis()), - "Computed width should always be constrained, so horizontal " - "flex containers should have a constrained main-size"); + // Vertical case, with non-auto-height: + if (aReflowState.ComputedHeight() != NS_AUTOHEIGHT) { + return aReflowState.ComputedHeight(); + } - // Otherwise, use the sum of our items' hypothetical main sizes, clamped - // to our computed min/max main-size properties. - mainSize = 0; + // Vertical case, with auto-height: + // Resolve auto-height to the sum of our items' hypothetical outer main + // sizes (their outer heights), clamped to our computed min/max main-size + // properties (min-height & max-height). + nscoord sumOfChildHeights = 0; for (uint32_t i = 0; i < aItems.Length(); ++i) { - mainSize += + sumOfChildHeights += aItems[i].GetMainSize() + aItems[i].GetMarginBorderPaddingSizeInAxis(aAxisTracker.GetMainAxis()); } - nscoord minMainSize = - aAxisTracker.GetMainComponent(nsSize(aReflowState.mComputedMinWidth, - aReflowState.mComputedMinHeight)); - nscoord maxMainSize = - aAxisTracker.GetMainComponent(nsSize(aReflowState.mComputedMaxWidth, - aReflowState.mComputedMaxHeight)); - - return NS_CSS_MINMAX(mainSize, minMainSize, maxMainSize); + return NS_CSS_MINMAX(sumOfChildHeights, + aReflowState.mComputedMinHeight, + aReflowState.mComputedMaxHeight); } void diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index dc8a05ae3d7e..b8624a224fc3 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -83,6 +83,7 @@ #include "nsDeckFrame.h" #include "nsTableFrame.h" #include "nsSubDocumentFrame.h" +#include "nsSVGTextFrame2.h" #include "gfxContext.h" #include "nsRenderingContext.h" @@ -517,7 +518,8 @@ nsFrame::Init(nsIContent* aContent, mState |= state & (NS_FRAME_INDEPENDENT_SELECTION | NS_FRAME_GENERATED_CONTENT | NS_FRAME_IS_SVG_TEXT | - NS_FRAME_IN_POPUP); + NS_FRAME_IN_POPUP | + NS_FRAME_IS_NONDISPLAY); } const nsStyleDisplay *disp = StyleDisplay(); if (disp->HasTransform(this)) { @@ -696,6 +698,17 @@ nsFrame::GetOffsets(int32_t &aStart, int32_t &aEnd) const /* virtual */ void nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { + if (IsSVGText()) { + nsSVGTextFrame2* svgTextFrame = static_cast( + nsLayoutUtils::GetClosestFrameOfType(this, nsGkAtoms::svgTextFrame2)); + // Just as in nsSVGTextFrame2::DidSetStyleContext, we need to ensure that + // any non-display nsSVGTextFrame2s get reflowed when a child text frame + // gets new style. + if (svgTextFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) { + svgTextFrame->ScheduleReflowSVGNonDisplayText(); + } + } + ImageLoader* imageLoader = PresContext()->Document()->StyleImageLoader(); // If the old context had a background image image and new context @@ -5107,7 +5120,7 @@ nsIFrame::GetPreEffectsVisualOverflowRect() const nsFrame::UpdateOverflow() { MOZ_ASSERT(!(mState & NS_FRAME_SVG_LAYOUT) || - !(mState & NS_STATE_SVG_NONDISPLAY_CHILD), + !(mState & NS_FRAME_IS_NONDISPLAY), "Non-display SVG do not maintain visual overflow rects"); nsRect rect(nsPoint(0, 0), GetSize()); @@ -6774,7 +6787,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas, nsSize aNewSize, nsSize* aOldSize) { NS_ASSERTION(!((GetStateBits() & NS_FRAME_SVG_LAYOUT) && - (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)), + (GetStateBits() & NS_FRAME_IS_NONDISPLAY)), "Don't call - overflow rects not maintained on these SVG frames"); nsRect bounds(nsPoint(0, 0), aNewSize); @@ -6921,7 +6934,7 @@ nsIFrame::RecomputePerspectiveChildrenOverflow(const nsStyleContext* aStartStyle for (; !childFrames.AtEnd(); childFrames.Next()) { nsIFrame* child = childFrames.get(); if ((child->GetStateBits() & NS_FRAME_SVG_LAYOUT) && - (child->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + (child->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { continue; // frame does not maintain overflow rects } if (child->HasPerspective()) { @@ -6971,7 +6984,7 @@ RecomputePreserve3DChildrenOverflow(nsIFrame* aFrame, const nsRect* aBounds) for (; !childFrames.AtEnd(); childFrames.Next()) { nsIFrame* child = childFrames.get(); if ((child->GetStateBits() & NS_FRAME_SVG_LAYOUT) && - (child->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + (child->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { continue; // frame does not maintain overflow rects } if (child->Preserves3DChildren()) { diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 6ec929de67cc..d49e8e74fee2 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -321,6 +321,10 @@ typedef uint64_t nsFrameState; // rect stored to invalidate. #define NS_FRAME_HAS_INVALID_RECT NS_FRAME_STATE_BIT(52) +// Frame is not displayed directly due to it being, or being under, an SVG +// element or an SVG resource element (, , etc.) +#define NS_FRAME_IS_NONDISPLAY NS_FRAME_STATE_BIT(53) + // Box layout bits #define NS_STATE_IS_HORIZONTAL NS_FRAME_STATE_BIT(22) #define NS_STATE_IS_DIRECTION_NORMAL NS_FRAME_STATE_BIT(31) diff --git a/layout/generic/nsIntervalSet.cpp b/layout/generic/nsIntervalSet.cpp index cc30e38d54e0..92cd8c2989e9 100644 --- a/layout/generic/nsIntervalSet.cpp +++ b/layout/generic/nsIntervalSet.cpp @@ -8,7 +8,7 @@ #include "nsIntervalSet.h" #include "nsAlgorithm.h" -#include NEW_H +#include #include nsIntervalSet::nsIntervalSet(IntervalSetAlloc aAlloc, IntervalSetFree aFree, diff --git a/layout/inspector/src/Makefile.in b/layout/inspector/src/Makefile.in index 6307f836ca14..2ee11661279a 100644 --- a/layout/inspector/src/Makefile.in +++ b/layout/inspector/src/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES += \ -I$(srcdir)/../../style \ -I$(topsrcdir)/content/base/src \ diff --git a/layout/ipc/Makefile.in b/layout/ipc/Makefile.in index 7c7a54111ebd..ad5e9249f4e5 100644 --- a/layout/ipc/Makefile.in +++ b/layout/ipc/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkipc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/layout/mathml/Makefile.in b/layout/mathml/Makefile.in index c00a8a2867a3..0dff8229a53c 100644 --- a/layout/mathml/Makefile.in +++ b/layout/mathml/Makefile.in @@ -28,10 +28,6 @@ LOCAL_INCLUDES = \ include $(topsrcdir)/config/config.mk -# we don't want the shared lib, but we want to force the creation of a static lib. -# do we still want this? - DJF -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk font_properties = \ diff --git a/layout/printing/Makefile.in b/layout/printing/Makefile.in index 5422ff2f24e2..db5a3c1ba8d7 100644 --- a/layout/printing/Makefile.in +++ b/layout/printing/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ diff --git a/layout/reftests/bugs/860242-1-ref.html b/layout/reftests/bugs/860242-1-ref.html new file mode 100644 index 000000000000..cccdeeefd255 --- /dev/null +++ b/layout/reftests/bugs/860242-1-ref.html @@ -0,0 +1,47 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/layout/reftests/bugs/860242-1.html b/layout/reftests/bugs/860242-1.html new file mode 100644 index 000000000000..ea5c9fff92dd --- /dev/null +++ b/layout/reftests/bugs/860242-1.html @@ -0,0 +1,48 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 2f8729ee06f9..f58aa91ec1b1 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1758,6 +1758,7 @@ fails-if(Android&&AndroidVersion<15) == 836844-1.html 836844-1-ref.html test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html == 849996-1.html 849996-1-ref.html == 858803-1.html 858803-1-ref.html +== 860242-1.html 860242-1-ref.html != 860370.html 860370-notref.html == 871338-1.html 871338-1-ref.html random-if(Android&&AndroidVersion>=15) == 875060-1.html 875060-1-ref.html #Bug 885303 diff --git a/layout/reftests/dom/reftest.list b/layout/reftests/dom/reftest.list index 859c2a8f879d..0ceeb830d56d 100644 --- a/layout/reftests/dom/reftest.list +++ b/layout/reftests/dom/reftest.list @@ -50,3 +50,4 @@ skip-if(B2G) == multipleinsertionpoints-insertmultiple.xhtml multipleinsertionpo == multipleappendwitheditable.xhtml multipleappendwitheditable-ref.xhtml skip-if(B2G) == xbl-children-1.xhtml xbl-children-1-ref.xhtml +skip-if(B2G) == xbl-children-2.xhtml about:blank diff --git a/layout/reftests/dom/xbl-children-2.xhtml b/layout/reftests/dom/xbl-children-2.xhtml new file mode 100644 index 000000000000..97b511538520 --- /dev/null +++ b/layout/reftests/dom/xbl-children-2.xhtml @@ -0,0 +1,28 @@ + + + + + + + FAIL + + + + FAIL + + + + + + + diff --git a/layout/reftests/svg/marker-orientation-02-ref.svg b/layout/reftests/svg/marker-orientation-02-ref.svg new file mode 100644 index 000000000000..b447aa43ff6c --- /dev/null +++ b/layout/reftests/svg/marker-orientation-02-ref.svg @@ -0,0 +1,69 @@ + + + Reference for test that marker orientation is correct at the end of + arcs when orient="auto-start-reverse-start-reverse" is used + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/marker-orientation-02.svg b/layout/reftests/svg/marker-orientation-02.svg new file mode 100644 index 000000000000..049b9a1e8d30 --- /dev/null +++ b/layout/reftests/svg/marker-orientation-02.svg @@ -0,0 +1,64 @@ + + + Test that marker orientation is correct at the end of arcs when + orient="auto-start-reverse-start-reverse" is used + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 8668c5f6908f..d9334cd76146 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -184,6 +184,7 @@ fuzzy-if(Android,9,980) == gradient-live-01d.svg gradient-live-01-ref.svg == marker-attribute-01.svg pass.svg == marker-viewBox-01.svg marker-viewBox-01-ref.svg == marker-orientation-01.svg marker-orientation-01-ref.svg +pref(svg.marker-improvements.enabled,true) == marker-orientation-02.svg marker-orientation-02-ref.svg == mask-basic-01.svg pass.svg == mask-basic-02.svg mask-basic-02-ref.svg == mask-basic-03.svg pass.svg diff --git a/layout/style/Makefile.in b/layout/style/Makefile.in index d1e7c7f43c2d..76769c5174f0 100644 --- a/layout/style/Makefile.in +++ b/layout/style/Makefile.in @@ -19,8 +19,6 @@ OS_CFLAGS := $(OS_CFLAGS) -Wshadow OS_CXXFLAGS := $(OS_CXXFLAGS) -Wshadow endif -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index f961205184ec..ec16e670b867 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -2312,9 +2312,7 @@ static bool SelectorMatchesTree(Element* aPrevElement, // element wasn't in the tree to allow old selectors // were written before participated in CSS selector // matching to work. - if (selector->mOperator == '>' && - element->NodeInfo()->Equals(nsGkAtoms::children, - kNameSpaceID_XBL)) { + if (selector->mOperator == '>' && element->IsActiveChildrenElement()) { Element* styleScope = aTreeMatchContext.mCurrentStyleScope; if (SelectorMatchesTree(element, selector, aTreeMatchContext, aLookForRelevantLink)) { diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 353f5646a487..95e270218ccc 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2256,6 +2256,10 @@ struct nsStyleSVG { bool mStrokeDasharrayFromObject : 1; bool mStrokeDashoffsetFromObject : 1; bool mStrokeWidthFromObject : 1; + + bool HasMarker() const { + return mMarkerStart || mMarkerMid || mMarkerEnd; + } }; struct nsStyleSVGReset { diff --git a/layout/svg/Makefile.in b/layout/svg/Makefile.in index 885b2b898720..51613e3f1e46 100644 --- a/layout/svg/Makefile.in +++ b/layout/svg/Makefile.in @@ -17,9 +17,6 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/config.mk -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/layout/svg/SVGFEContainerFrame.cpp b/layout/svg/SVGFEContainerFrame.cpp index 3e866622e3d6..ffd1314f4674 100644 --- a/layout/svg/SVGFEContainerFrame.cpp +++ b/layout/svg/SVGFEContainerFrame.cpp @@ -25,7 +25,7 @@ class SVGFEContainerFrame : public SVGFEContainerFrameBase SVGFEContainerFrame(nsStyleContext* aContext) : SVGFEContainerFrameBase(aContext) { - AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/SVGFEImageFrame.cpp b/layout/svg/SVGFEImageFrame.cpp index dd769ff9d7cd..e0b0983d531b 100644 --- a/layout/svg/SVGFEImageFrame.cpp +++ b/layout/svg/SVGFEImageFrame.cpp @@ -25,7 +25,7 @@ class SVGFEImageFrame : public SVGFEImageFrameBase SVGFEImageFrame(nsStyleContext* aContext) : SVGFEImageFrameBase(aContext) { - AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/SVGFELeafFrame.cpp b/layout/svg/SVGFELeafFrame.cpp index 4f578f27dd6d..bb6a894049f8 100644 --- a/layout/svg/SVGFELeafFrame.cpp +++ b/layout/svg/SVGFELeafFrame.cpp @@ -23,7 +23,7 @@ class SVGFELeafFrame : public SVGFELeafFrameBase SVGFELeafFrame(nsStyleContext* aContext) : SVGFELeafFrameBase(aContext) { - AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/SVGFEUnstyledLeafFrame.cpp b/layout/svg/SVGFEUnstyledLeafFrame.cpp index a064d50df09a..f8ef693393b1 100644 --- a/layout/svg/SVGFEUnstyledLeafFrame.cpp +++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp @@ -19,7 +19,7 @@ class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase SVGFEUnstyledLeafFrame(nsStyleContext* aContext) : SVGFEUnstyledLeafFrameBase(aContext) { - AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/SVGViewFrame.cpp b/layout/svg/SVGViewFrame.cpp index fea73577d711..b0948038ed27 100644 --- a/layout/svg/SVGViewFrame.cpp +++ b/layout/svg/SVGViewFrame.cpp @@ -28,7 +28,7 @@ class SVGViewFrame : public SVGViewFrameBase SVGViewFrame(nsStyleContext* aContext) : SVGViewFrameBase(aContext) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/crashtests/890782-1.svg b/layout/svg/crashtests/890782-1.svg new file mode 100644 index 000000000000..686bc73a8f15 --- /dev/null +++ b/layout/svg/crashtests/890782-1.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/layout/svg/crashtests/890783-1.svg b/layout/svg/crashtests/890783-1.svg new file mode 100644 index 000000000000..25f54ba2a3ab --- /dev/null +++ b/layout/svg/crashtests/890783-1.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index e393d199c289..fe1a2da64933 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -169,3 +169,5 @@ load 877029-1.svg load 880925-1.svg load 881031-1.svg load 885608-1.svg +load 890782-1.svg +load 890783-1.svg diff --git a/layout/svg/nsISVGChildFrame.h b/layout/svg/nsISVGChildFrame.h index 51036ffb01a0..07733ce3b6c3 100644 --- a/layout/svg/nsISVGChildFrame.h +++ b/layout/svg/nsISVGChildFrame.h @@ -57,7 +57,7 @@ class nsISVGChildFrame : public nsQueryFrame // Get bounds in our gfxContext's coordinates space (in app units) NS_IMETHOD_(nsRect) GetCoveredRegion()=0; - // Called on SVG child frames (except NS_STATE_SVG_NONDISPLAY_CHILD frames) + // Called on SVG child frames (except NS_FRAME_IS_NONDISPLAY frames) // to update and then invalidate their cached bounds. This method is not // called until after the nsSVGOuterSVGFrame has had its initial reflow // (i.e. once the SVG viewport dimensions are known). It should also only @@ -81,7 +81,7 @@ class nsISVGChildFrame : public nsQueryFrame // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when // updating the descendant frames of a clipPath, // mask, pattern or marker frame (or other similar - // NS_STATE_SVG_NONDISPLAY_CHILD frame) immediately + // NS_FRAME_IS_NONDISPLAY frame) immediately // prior to painting that frame's descendants. // TRANSFORM_CHANGED - the current transform matrix for this frame has changed // COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has diff --git a/layout/svg/nsSVGAFrame.cpp b/layout/svg/nsSVGAFrame.cpp index 9701a87a173b..3b77ce644d26 100644 --- a/layout/svg/nsSVGAFrame.cpp +++ b/layout/svg/nsSVGAFrame.cpp @@ -145,7 +145,7 @@ nsSVGAFrame::NotifySVGChanged(uint32_t aFlags) gfxMatrix nsSVGAFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGClipPathFrame.h b/layout/svg/nsSVGClipPathFrame.h index 9c0d33a1996a..ce04797389cb 100644 --- a/layout/svg/nsSVGClipPathFrame.h +++ b/layout/svg/nsSVGClipPathFrame.h @@ -25,7 +25,7 @@ class nsSVGClipPathFrame : public nsSVGClipPathFrameBase : nsSVGClipPathFrameBase(aContext) , mInUse(false) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/nsSVGContainerFrame.cpp b/layout/svg/nsSVGContainerFrame.cpp index 9177f4072dc6..f959e6dcfefb 100644 --- a/layout/svg/nsSVGContainerFrame.cpp +++ b/layout/svg/nsSVGContainerFrame.cpp @@ -33,7 +33,7 @@ NS_NewSVGContainerFrame(nsIPresShell* aPresShell, // If we were called directly, then the frame is for a or // an unknown element type. In both cases we prevent the content // from displaying directly. - frame->AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + frame->AddStateBits(NS_FRAME_IS_NONDISPLAY); return frame; } @@ -74,7 +74,7 @@ nsSVGContainerFrame::RemoveFrame(ChildListID aListID, bool nsSVGContainerFrame::UpdateOverflow() { - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { // We don't maintain overflow rects. // XXX It would have be better if the restyle request hadn't even happened. return false; @@ -88,8 +88,7 @@ nsSVGDisplayContainerFrame::Init(nsIContent* aContent, nsIFrame* aPrevInFlow) { if (!(GetStateBits() & NS_STATE_IS_OUTER_SVG)) { - AddStateBits(aParent->GetStateBits() & - (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD)); + AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD); } nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow); } @@ -114,7 +113,7 @@ nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID, // memorize first old frame after insertion point // XXXbz once again, this would work a lot better if the nsIFrame // methods returned framelist iterators.... - nsIFrame* firstOldFrame = aPrevFrame ? + nsIFrame* nextFrame = aPrevFrame ? aPrevFrame->GetNextSibling() : GetChildList(aListID).FirstChild(); nsIFrame* firstNewFrame = aFrameList.FirstChild(); @@ -125,12 +124,12 @@ nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID, // pending, then we need to schedule one for our new children: if (!(GetStateBits() & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN | - NS_STATE_SVG_NONDISPLAY_CHILD))) { - for (nsIFrame* kid = firstNewFrame; kid != firstOldFrame; + NS_FRAME_IS_NONDISPLAY))) { + for (nsIFrame* kid = firstNewFrame; kid != nextFrame; kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) { - NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), "Check for this explicitly in the |if|, then"); bool isFirstReflow = (kid->GetStateBits() & NS_FRAME_FIRST_REFLOW); // Remove bits so that ScheduleBoundsUpdate will work: @@ -165,7 +164,7 @@ nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID, nsresult rv = nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame); - if (!(GetStateBits() & (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_IS_OUTER_SVG))) { + if (!(GetStateBits() & (NS_FRAME_IS_NONDISPLAY | NS_STATE_IS_OUTER_SVG))) { nsSVGUtils::NotifyAncestorsOfFilterRegionChange(this); } @@ -210,7 +209,7 @@ nsSVGDisplayContainerFrame::PaintSVG(nsRenderingContext* aContext, const nsIntRect *aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD) || + (mState & NS_FRAME_IS_NONDISPLAY) || PresContext()->IsGlyph(), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -231,7 +230,7 @@ NS_IMETHODIMP_(nsIFrame*) nsSVGDisplayContainerFrame::GetFrameForPoint(const nsPoint &aPoint) { NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only hit-testing of a " "clipPath's contents should take this code path"); return nsSVGUtils::HitTestChildren(this, aPoint); @@ -244,12 +243,12 @@ nsSVGDisplayContainerFrame::GetCoveredRegion() } /** - * Traverses a frame tree, marking any nsSVGTextFrame2 frame as dirty + * Traverses a frame tree, marking any nsSVGTextFrame2 frames as dirty * and calling InvalidateRenderingObservers() on it. * * The reason that this helper exists is because nsSVGTextFrame2 is special. * None of the other SVG frames ever need to be reflowed when they have the - * NS_STATE_SVG_NONDISPLAY_CHILD bit set on them because their PaintSVG methods + * NS_FRAME_IS_NONDISPLAY bit set on them because their PaintSVG methods * (and those of any containers that they can validly be contained within) do * not make use of mRect or overflow rects. "em" lengths, etc., are resolved * as those elements are painted. @@ -261,27 +260,30 @@ nsSVGDisplayContainerFrame::GetCoveredRegion() * * We assume that any change that requires the anonymous kid of an * nsSVGTextFrame2 to reflow will result in an NS_FRAME_IS_DIRTY reflow. When - * that reflow reaches an NS_STATE_SVG_NONDISPLAY_CHILD frame it would normally + * that reflow reaches an NS_FRAME_IS_NONDISPLAY frame it would normally * stop, but this helper looks for any nsSVGTextFrame2 descendants of such * frames and marks them NS_FRAME_IS_DIRTY so that the next time that they are * painted their anonymous kid will first get the necessary reflow. */ static void -ReflowSVGNonDisplayText(nsSVGContainerFrame* aContainer) +ReflowSVGNonDisplayText(nsIFrame* aContainer) { NS_ASSERTION(aContainer->GetStateBits() & NS_FRAME_IS_DIRTY, "expected aContainer to be NS_FRAME_IS_DIRTY"); - NS_ASSERTION(aContainer->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD, + NS_ASSERTION((aContainer->GetStateBits() & NS_FRAME_IS_NONDISPLAY) || + !aContainer->IsFrameOfType(nsIFrame::eSVG), "it is wasteful to call ReflowSVGNonDisplayText on a container " - "frame that is not NS_STATE_SVG_NONDISPLAY_CHILD"); + "frame that is not NS_FRAME_IS_NONDISPLAY"); for (nsIFrame* kid = aContainer->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) { - if (kid->GetType() == nsGkAtoms::svgTextFrame2) { + nsIAtom* type = kid->GetType(); + if (type == nsGkAtoms::svgTextFrame2) { static_cast(kid)->ReflowSVGNonDisplayText(); } else { - nsSVGContainerFrame* kidContainer = do_QueryFrame(kid); - if (kidContainer && kidContainer->GetContent()->IsSVG()) { - ReflowSVGNonDisplayText(kidContainer); + if (kid->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer) || + type == nsGkAtoms::svgForeignObjectFrame || + !kid->IsFrameOfType(nsIFrame::eSVG)) { + ReflowSVGNonDisplayText(kid); } } } @@ -293,7 +295,7 @@ nsSVGDisplayContainerFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); NS_ABORT_IF_FALSE(GetType() != nsGkAtoms::svgOuterSVGFrame, @@ -323,7 +325,7 @@ nsSVGDisplayContainerFrame::ReflowSVG() kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) { - NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), "Check for this explicitly in the |if|, then"); kid->AddStateBits(mState & NS_FRAME_IS_DIRTY); SVGFrame->ReflowSVG(); @@ -336,8 +338,8 @@ nsSVGDisplayContainerFrame::ReflowSVG() // Inside a non-display container frame, we might have some // nsSVGTextFrame2s. We need to cause those to get reflowed in // case they are the target of a rendering observer. - NS_ASSERTION(kid->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD, - "expected kid to be a NS_STATE_SVG_NONDISPLAY_CHILD frame"); + NS_ASSERTION(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY, + "expected kid to be a NS_FRAME_IS_NONDISPLAY frame"); if (kid->GetStateBits() & NS_FRAME_IS_DIRTY) { nsSVGContainerFrame* container = do_QueryFrame(kid); if (container && container->GetContent()->IsSVG()) { diff --git a/layout/svg/nsSVGFilterFrame.cpp b/layout/svg/nsSVGFilterFrame.cpp index 80fb159be38d..98ce4f14dddb 100644 --- a/layout/svg/nsSVGFilterFrame.cpp +++ b/layout/svg/nsSVGFilterFrame.cpp @@ -507,7 +507,7 @@ nsSVGFilterFrame::GetPostFilterBounds(nsIFrame *aFilteredFrame, const nsRect *aPreFilterBounds) { MOZ_ASSERT(!(aFilteredFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) || - !(aFilteredFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + !(aFilteredFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY), "Non-display SVG do not maintain visual overflow rects"); nsAutoFilterInstance instance(aFilteredFrame, this, nullptr, nullptr, diff --git a/layout/svg/nsSVGFilterFrame.h b/layout/svg/nsSVGFilterFrame.h index 3c028a03d041..e494a9aae96d 100644 --- a/layout/svg/nsSVGFilterFrame.h +++ b/layout/svg/nsSVGFilterFrame.h @@ -41,7 +41,7 @@ class nsSVGFilterFrame : public nsSVGFilterFrameBase mLoopFlag(false), mNoHRefURI(false) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index c9ac187acb92..fd790909dbdb 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -61,11 +61,10 @@ nsSVGForeignObjectFrame::Init(nsIContent* aContent, "Content is not an SVG foreignObject!"); nsSVGForeignObjectFrameBase::Init(aContent, aParent, aPrevInFlow); - AddStateBits(aParent->GetStateBits() & - (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD)); + AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD); AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER | NS_FRAME_FONT_INFLATION_FLOW_ROOT); - if (!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(mState & NS_FRAME_IS_NONDISPLAY)) { nsSVGUtils::GetOuterSVGFrame(this)->RegisterForeignObject(this); } } @@ -73,7 +72,7 @@ nsSVGForeignObjectFrame::Init(nsIContent* aContent, void nsSVGForeignObjectFrame::DestroyFrom(nsIFrame* aDestructRoot) { // Only unregister if we registered in the first place: - if (!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(mState & NS_FRAME_IS_NONDISPLAY)) { nsSVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this); } nsSVGForeignObjectFrameBase::DestroyFrom(aDestructRoot); @@ -124,7 +123,7 @@ nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "Should not have been called"); // Only InvalidateAndScheduleBoundsUpdate marks us with NS_FRAME_IS_DIRTY, @@ -198,7 +197,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext, const nsIntRect *aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -221,7 +220,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext, /* Check if we need to draw anything. */ if (aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "Display lists handle dirty rect intersection test"); // Transform the dirty rect into app units in our userspace. gfxMatrix invmatrix = canvasTM; @@ -285,11 +284,11 @@ NS_IMETHODIMP_(nsIFrame*) nsSVGForeignObjectFrame::GetFrameForPoint(const nsPoint &aPoint) { NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only hit-testing of a " "clipPath's contents should take this code path"); - if (IsDisabled() || (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) + if (IsDisabled() || (GetStateBits() & NS_FRAME_IS_NONDISPLAY)) return nullptr; nsIFrame* kid = GetFirstPrincipalChild(); @@ -344,7 +343,7 @@ nsSVGForeignObjectFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { @@ -489,7 +488,7 @@ nsSVGForeignObjectFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, gfxMatrix nsSVGForeignObjectFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGGFrame.cpp b/layout/svg/nsSVGGFrame.cpp index adffe40cde5b..19e719ff7f2e 100644 --- a/layout/svg/nsSVGGFrame.cpp +++ b/layout/svg/nsSVGGFrame.cpp @@ -67,7 +67,7 @@ nsSVGGFrame::NotifySVGChanged(uint32_t aFlags) gfxMatrix nsSVGGFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGGenericContainerFrame.cpp b/layout/svg/nsSVGGenericContainerFrame.cpp index b00433fd8c85..068ba8bf7fc1 100644 --- a/layout/svg/nsSVGGenericContainerFrame.cpp +++ b/layout/svg/nsSVGGenericContainerFrame.cpp @@ -48,7 +48,7 @@ nsSVGGenericContainerFrame::GetType() const gfxMatrix nsSVGGenericContainerFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGGeometryFrame.cpp b/layout/svg/nsSVGGeometryFrame.cpp index 7c08981fc66f..b0f7fe9bb0a2 100644 --- a/layout/svg/nsSVGGeometryFrame.cpp +++ b/layout/svg/nsSVGGeometryFrame.cpp @@ -24,8 +24,7 @@ nsSVGGeometryFrame::Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow) { - AddStateBits(aParent->GetStateBits() & - (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD)); + AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD); nsSVGGeometryFrameBase::Init(aContent, aParent, aPrevInFlow); } diff --git a/layout/svg/nsSVGGlyphFrame.cpp b/layout/svg/nsSVGGlyphFrame.cpp index b9094cf1d890..9fc04c87404b 100644 --- a/layout/svg/nsSVGGlyphFrame.cpp +++ b/layout/svg/nsSVGGlyphFrame.cpp @@ -307,7 +307,7 @@ nsSVGGlyphFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) nsSVGGlyphFrameBase::DidSetStyleContext(aOldStyleContext); if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW) || - (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + (GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { ClearTextRun(); NotifyGlyphMetricsChange(); } @@ -499,7 +499,7 @@ nsSVGGlyphFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); mRect.SetEmpty(); @@ -677,7 +677,7 @@ nsSVGGlyphFrame::GetCanvasTM(uint32_t aFor) if (mOverrideCanvasTM) { return *mOverrideCanvasTM; } - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); @@ -1679,7 +1679,7 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale, gfxMatrix m; if (aForceGlobalTransform || - !(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + !(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { m = GetCanvasTM(mGetCanvasTMForFlag); if (m.IsSingular()) return false; diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index 3f3721604edb..d9b85bbc712f 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -323,7 +323,7 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext, nsRect dirtyRect; // only used if aDirtyRect is non-null if (aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "Display lists handle dirty rect intersection test"); dirtyRect = aDirtyRect->ToAppUnits(appUnitsPerDevPx); // Adjust dirtyRect to match our local coordinate system. @@ -432,7 +432,7 @@ nsSVGImageFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { diff --git a/layout/svg/nsSVGInnerSVGFrame.cpp b/layout/svg/nsSVGInnerSVGFrame.cpp index 2c8a3c34f2b3..c6cf0c29f015 100644 --- a/layout/svg/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/nsSVGInnerSVGFrame.cpp @@ -62,7 +62,7 @@ nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext, const nsIntRect *aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -167,7 +167,7 @@ nsSVGInnerSVGFrame::AttributeChanged(int32_t aNameSpaceID, int32_t aModType) { if (aNameSpaceID == kNameSpaceID_None && - !(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + !(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { SVGSVGElement* content = static_cast(mContent); @@ -228,7 +228,7 @@ NS_IMETHODIMP_(nsIFrame*) nsSVGInnerSVGFrame::GetFrameForPoint(const nsPoint &aPoint) { NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only hit-testing of non-display " "SVG should take this code path"); @@ -270,7 +270,7 @@ nsSVGInnerSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) gfxMatrix nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 8ad7527f1433..eeb454e1a8bb 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -402,7 +402,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, #ifdef DEBUG NS_ASSERTION(!(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) || (NS_SVGDisplayListPaintingEnabled() && - !(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)), + !(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)), "Should not use nsSVGIntegrationUtils on this SVG frame"); #endif diff --git a/layout/svg/nsSVGMarkerFrame.cpp b/layout/svg/nsSVGMarkerFrame.cpp index 2c5b463226c4..99731b4862dd 100644 --- a/layout/svg/nsSVGMarkerFrame.cpp +++ b/layout/svg/nsSVGMarkerFrame.cpp @@ -85,7 +85,8 @@ nsSVGMarkerFrame::GetCanvasTM(uint32_t aFor) gfxMatrix markedTM = mMarkedFrame->GetCanvasTM(aFor); mInUse2 = false; - gfxMatrix markerTM = content->GetMarkerTransform(mStrokeWidth, mX, mY, mAutoAngle); + gfxMatrix markerTM = content->GetMarkerTransform(mStrokeWidth, mX, mY, + mAutoAngle, mIsStart); gfxMatrix viewBoxTM = content->GetViewBoxTransform(); return viewBoxTM * markerTM * markedTM; @@ -118,6 +119,7 @@ nsSVGMarkerFrame::PaintMark(nsRenderingContext *aContext, mX = aMark->x; mY = aMark->y; mAutoAngle = aMark->angle; + mIsStart = aMark->type == nsSVGMark::eStart; gfxContext *gfx = aContext->ThebesContext(); @@ -175,9 +177,10 @@ nsSVGMarkerFrame::GetMarkBBoxContribution(const gfxMatrix &aToBBoxUserspace, mX = aMark->x; mY = aMark->y; mAutoAngle = aMark->angle; + mIsStart = aMark->type == nsSVGMark::eStart; gfxMatrix markerTM = - content->GetMarkerTransform(mStrokeWidth, mX, mY, mAutoAngle); + content->GetMarkerTransform(mStrokeWidth, mX, mY, mAutoAngle, mIsStart); gfxMatrix viewBoxTM = content->GetViewBoxTransform(); gfxMatrix tm = viewBoxTM * markerTM * aToBBoxUserspace; diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index 4f10e30cc14c..29de614e5727 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -44,7 +44,7 @@ class nsSVGMarkerFrame : public nsSVGMarkerFrameBase , mInUse(false) , mInUse2(false) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: @@ -94,6 +94,7 @@ class nsSVGMarkerFrame : public nsSVGMarkerFrameBase // stuff needed for callback nsSVGPathGeometryFrame *mMarkedFrame; float mStrokeWidth, mX, mY, mAutoAngle; + bool mIsStart; // whether the callback is for a marker-start marker // nsSVGContainerFrame methods: virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE; diff --git a/layout/svg/nsSVGMaskFrame.h b/layout/svg/nsSVGMaskFrame.h index 668626e05626..2781f1968f89 100644 --- a/layout/svg/nsSVGMaskFrame.h +++ b/layout/svg/nsSVGMaskFrame.h @@ -26,7 +26,7 @@ class nsSVGMaskFrame : public nsSVGMaskFrameBase : nsSVGMaskFrameBase(aContext) , mInUse(false) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index d676d212c5d7..aea2f60c097a 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -161,25 +161,12 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent, // simply giving failing outer elements an nsSVGContainerFrame. // We don't create other SVG frames if PassesConditionalProcessingTests // returns false, but since we do create nsSVGOuterSVGFrame frames we - // prevent them from painting by [ab]use NS_STATE_SVG_NONDISPLAY_CHILD. The + // prevent them from painting by [ab]use NS_FRAME_IS_NONDISPLAY. The // frame will be recreated via an nsChangeHint_ReconstructFrame restyle if // the value returned by PassesConditionalProcessingTests changes. SVGSVGElement *svg = static_cast(aContent); if (!svg->PassesConditionalProcessingTests()) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); - } else { - // If this outer element is the child of a that - // is non-display, or is the child of a frame for HTML content that - // itself is a descendant of a non-display SVG frame, then we want to - // it non-display also. The second case is not as simple to handle - // as copying a state bit from the parent, since non-SVG frames do - // not use NS_STATE_SVG_NONDISPLAY_CHILD. - for (nsIFrame* f = aParent; f; f = f->GetParent()) { - if (f->IsFrameOfType(eSVG)) { - AddStateBits(f->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD); - break; - } - } + AddStateBits(NS_FRAME_IS_NONDISPLAY); } nsSVGOuterSVGFrameBase::Init(aContent, aParent, aPrevInFlow); @@ -476,7 +463,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext, } mViewportInitialized = true; - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { // Now that we've marked the necessary children as dirty, call // ReflowSVG() on them: @@ -721,7 +708,7 @@ nsSVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID, int32_t aModType) { if (aNameSpaceID == kNameSpaceID_None && - !(GetStateBits() & (NS_FRAME_FIRST_REFLOW | NS_STATE_SVG_NONDISPLAY_CHILD))) { + !(GetStateBits() & (NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_NONDISPLAY))) { if (aAttribute == nsGkAtoms::viewBox || aAttribute == nsGkAtoms::preserveAspectRatio || aAttribute == nsGkAtoms::transform) { @@ -772,7 +759,7 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) { return; } @@ -863,7 +850,7 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) mCanvasTM = nullptr; if (haveNonFulLZoomTransformChange && - !(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) { + !(mState & NS_FRAME_IS_NONDISPLAY)) { uint32_t flags = (mState & NS_FRAME_IN_REFLOW) ? SVGSVGElement::eDuringReflow : 0; content->ChildrenOnlyTransformChanged(flags); @@ -910,7 +897,7 @@ nsSVGOuterSVGFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, gfxMatrix nsSVGOuterSVGFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGPaintServerFrame.h b/layout/svg/nsSVGPaintServerFrame.h index 67951c7b0bec..7f0c84c58d11 100644 --- a/layout/svg/nsSVGPaintServerFrame.h +++ b/layout/svg/nsSVGPaintServerFrame.h @@ -29,7 +29,7 @@ class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase nsSVGPaintServerFrame(nsStyleContext* aContext) : nsSVGPaintServerFrameBase(aContext) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index 33610b66e981..d81f33976ef6 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -271,7 +271,7 @@ nsSVGPathGeometryFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { @@ -452,30 +452,21 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, static_cast(mContent)->GetMarkPoints(&marks); uint32_t num = marks.Length(); - if (num) { - nsSVGMarkerFrame *frame = properties.GetMarkerStartFrame(); - if (frame) { - SVGBBox mbbox = - frame->GetMarkBBoxContribution(aToBBoxUserspace, aFlags, this, - &marks[0], strokeWidth); - bbox.UnionEdges(mbbox); - } - - frame = properties.GetMarkerMidFrame(); - if (frame) { - for (uint32_t i = 1; i < num - 1; i++) { - SVGBBox mbbox = - frame->GetMarkBBoxContribution(aToBBoxUserspace, aFlags, this, - &marks[i], strokeWidth); - bbox.UnionEdges(mbbox); - } - } - - frame = properties.GetMarkerEndFrame(); + // These are in the same order as the nsSVGMark::Type constants. + nsSVGMarkerFrame* markerFrames[] = { + properties.GetMarkerStartFrame(), + properties.GetMarkerMidFrame(), + properties.GetMarkerEndFrame(), + }; + PR_STATIC_ASSERT(NS_ARRAY_LENGTH(markerFrames) == nsSVGMark::eTypeCount); + + for (uint32_t i = 0; i < num; i++) { + nsSVGMark& mark = marks[i]; + nsSVGMarkerFrame* frame = markerFrames[mark.type]; if (frame) { SVGBBox mbbox = frame->GetMarkBBoxContribution(aToBBoxUserspace, aFlags, this, - &marks[num-1], strokeWidth); + &marks[i], strokeWidth); bbox.UnionEdges(mbbox); } } @@ -491,7 +482,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, gfxMatrix nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); @@ -655,21 +646,22 @@ nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext) (mContent)->GetMarkPoints(&marks); uint32_t num = marks.Length(); - if (num) { - nsSVGMarkerFrame *frame = properties.GetMarkerStartFrame(); - if (frame) - frame->PaintMark(aContext, this, &marks[0], strokeWidth); - - frame = properties.GetMarkerMidFrame(); - if (frame) { - for (uint32_t i = 1; i < num - 1; i++) - frame->PaintMark(aContext, this, &marks[i], strokeWidth); + // These are in the same order as the nsSVGMark::Type constants. + nsSVGMarkerFrame* markerFrames[] = { + properties.GetMarkerStartFrame(), + properties.GetMarkerMidFrame(), + properties.GetMarkerEndFrame(), + }; + PR_STATIC_ASSERT(NS_ARRAY_LENGTH(markerFrames) == nsSVGMark::eTypeCount); + + for (uint32_t i = 0; i < num; i++) { + nsSVGMark& mark = marks[i]; + nsSVGMarkerFrame* frame = markerFrames[mark.type]; + if (frame) { + frame->PaintMark(aContext, this, &mark, strokeWidth); + } } - - frame = properties.GetMarkerEndFrame(); - if (frame) - frame->PaintMark(aContext, this, &marks[num-1], strokeWidth); } } } diff --git a/layout/svg/nsSVGStopFrame.cpp b/layout/svg/nsSVGStopFrame.cpp index 815fb8b92cec..866904307bc5 100644 --- a/layout/svg/nsSVGStopFrame.cpp +++ b/layout/svg/nsSVGStopFrame.cpp @@ -23,7 +23,7 @@ class nsSVGStopFrame : public nsSVGStopFrameBase nsSVGStopFrame(nsStyleContext* aContext) : nsSVGStopFrameBase(aContext) { - AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD); + AddStateBits(NS_FRAME_IS_NONDISPLAY); } public: diff --git a/layout/svg/nsSVGSwitchFrame.cpp b/layout/svg/nsSVGSwitchFrame.cpp index 27411570f9f9..5a5937b7387a 100644 --- a/layout/svg/nsSVGSwitchFrame.cpp +++ b/layout/svg/nsSVGSwitchFrame.cpp @@ -108,7 +108,7 @@ nsSVGSwitchFrame::PaintSVG(nsRenderingContext* aContext, const nsIntRect *aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -127,7 +127,7 @@ NS_IMETHODIMP_(nsIFrame*) nsSVGSwitchFrame::GetFrameForPoint(const nsPoint &aPoint) { NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only hit-testing of non-display " "SVG should take this code path"); @@ -163,7 +163,7 @@ nsSVGSwitchFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { @@ -190,7 +190,7 @@ nsSVGSwitchFrame::ReflowSVG() if (child) { nsISVGChildFrame* svgChild = do_QueryFrame(child); if (svgChild) { - NS_ABORT_IF_FALSE(!(child->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY), "Check for this explicitly in the |if|, then"); svgChild->ReflowSVG(); diff --git a/layout/svg/nsSVGTSpanFrame.cpp b/layout/svg/nsSVGTSpanFrame.cpp index 359dc2ce8b90..6cde180c9332 100644 --- a/layout/svg/nsSVGTSpanFrame.cpp +++ b/layout/svg/nsSVGTSpanFrame.cpp @@ -93,7 +93,7 @@ nsSVGTSpanFrame::AttributeChanged(int32_t aNameSpaceID, gfxMatrix nsSVGTSpanFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGTextFrame.cpp b/layout/svg/nsSVGTextFrame.cpp index d078babe913c..58a3414fbf2b 100644 --- a/layout/svg/nsSVGTextFrame.cpp +++ b/layout/svg/nsSVGTextFrame.cpp @@ -206,7 +206,7 @@ nsSVGTextFrame::PaintSVG(nsRenderingContext* aContext, const nsIntRect *aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -219,7 +219,7 @@ NS_IMETHODIMP_(nsIFrame*) nsSVGTextFrame::GetFrameForPoint(const nsPoint &aPoint) { NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "If display lists are enabled, only hit-testing of non-display " "SVG should take this code path"); @@ -234,7 +234,7 @@ nsSVGTextFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { @@ -270,7 +270,7 @@ nsSVGTextFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, gfxMatrix nsSVGTextFrame::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); diff --git a/layout/svg/nsSVGTextFrame2.cpp b/layout/svg/nsSVGTextFrame2.cpp index e873eb6e519f..a43f451c423f 100644 --- a/layout/svg/nsSVGTextFrame2.cpp +++ b/layout/svg/nsSVGTextFrame2.cpp @@ -1510,7 +1510,7 @@ class TextFrameIterator */ TextFrameIterator(nsSVGTextFrame2* aRoot, nsIContent* aSubtree) : mRootFrame(aRoot), - mSubtree(aSubtree && aSubtree != aRoot->GetContent() ? + mSubtree(aRoot && aSubtree && aSubtree != aRoot->GetContent() ? aSubtree->GetPrimaryFrame() : nullptr), mCurrentFrame(aRoot), @@ -1605,6 +1605,10 @@ class TextFrameIterator */ void Init() { + if (!mRootFrame) { + return; + } + mBaselines.AppendElement(mRootFrame->StyleSVGReset()->mDominantBaseline); Next(); } @@ -3019,8 +3023,7 @@ nsSVGTextFrame2::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVG(nsGkAtoms::text), "Content is not an SVG text"); nsSVGTextFrame2Base::Init(aContent, aParent, aPrevInFlow); - AddStateBits((aParent->GetStateBits() & - (NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD)) | + AddStateBits((aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) | NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_SVG_TEXT); mMutationObserver.StartObserving(this); @@ -3079,7 +3082,7 @@ nsSVGTextFrame2::GetType() const void nsSVGTextFrame2::DidSetStyleContext(nsStyleContext* aOldStyleContext) { - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { // We need this DidSetStyleContext override to handle cases like this: // // @@ -3110,9 +3113,9 @@ nsSVGTextFrame2::ReflowSVGNonDisplayText() MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this), "only call ReflowSVGNonDisplayText when an outer SVG frame is " "under ReflowSVG"); - MOZ_ASSERT(mState & NS_STATE_SVG_NONDISPLAY_CHILD, + MOZ_ASSERT(mState & NS_FRAME_IS_NONDISPLAY, "only call ReflowSVGNonDisplayText if the frame is " - "NS_STATE_SVG_NONDISPLAY_CHILD"); + "NS_FRAME_IS_NONDISPLAY"); // We had a style change, so we mark this frame as dirty so that the next // time it is painted, we reflow the anonymous block frame. @@ -3138,36 +3141,37 @@ nsSVGTextFrame2::ScheduleReflowSVGNonDisplayText() "do not call ScheduleReflowSVGNonDisplayText when the outer SVG " "frame is under ReflowSVG"); - nsSVGOuterSVGFrame* outerSVGFrame = nullptr; - - nsIFrame* f = GetParent(); + // We need to find an ancestor frame that we can call FrameNeedsReflow + // on that will cause the document to be marked as needing relayout, + // and for that ancestor (or some further ancestor) to be marked as + // a root to reflow. We choose the closest ancestor frame that is not + // NS_FRAME_IS_NONDISPLAY and which is either an outer SVG frame or a + // non-SVG frame. (We don't consider displayed SVG frame ancestors toerh + // than nsSVGOuterSVGFrame, since calling FrameNeedsReflow on those other + // SVG frames would do a bunch of unnecessary work on the SVG frames up to + // the nsSVGOuterSVGFrame.) + + nsIFrame* f = this; while (f) { - if (f->GetStateBits() & NS_STATE_IS_OUTER_SVG) { - outerSVGFrame = static_cast(f); - break; - } - if (!(f->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { - // We don't need to set NS_FRAME_HAS_DIRTY_CHILDREN on non-display - // children in the path from the dirty nsSVGTextFrame2 up to the - // first display container frame, since ReflowSVGNonDisplayText - // does not check for it. + if (!(f->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if (NS_SUBTREE_DIRTY(f)) { + // This is a displayed frame, so if it is already dirty, we will be reflowed + // soon anyway. No need to call FrameNeedsReflow again, then. return; } + if (!f->IsFrameOfType(eSVG) || + (f->GetStateBits() & NS_STATE_IS_OUTER_SVG)) { + break; + } f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN); } f = f->GetParent(); } - NS_ABORT_IF_FALSE(outerSVGFrame && - outerSVGFrame->GetType() == nsGkAtoms::svgOuterSVGFrame, - "Did not find nsSVGOuterSVGFrame!"); - NS_ABORT_IF_FALSE(!(outerSVGFrame->GetStateBits() & NS_FRAME_IN_REFLOW), - "should not call ScheduleReflowSVGNonDisplayText under " - "nsSVGOuterSVGFrame::Reflow"); + MOZ_ASSERT(f, "should have found an ancestor frame to reflow"); PresContext()->PresShell()->FrameNeedsReflow( - outerSVGFrame, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); + f, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); } NS_IMPL_ISUPPORTS1(nsSVGTextFrame2::MutationObserver, nsIMutationObserver) @@ -3256,7 +3260,7 @@ nsSVGTextFrame2::FindCloserFrameForSelection( nsPoint aPoint, nsIFrame::FrameWithDistance* aCurrentBestFrame) { - if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) { return; } @@ -3408,7 +3412,7 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext, gfxContext *gfx = aContext->ThebesContext(); gfxMatrix initialMatrix = gfx->CurrentMatrix(); - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { // If we are in a canvas DrawWindow call that used the // DRAWWINDOW_DO_NOT_FLUSH flag, then we may still have out // of date frames. Just don't paint anything if they are @@ -3439,7 +3443,7 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext, // Check if we need to draw anything. if (aDirtyRect) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (mState & NS_STATE_SVG_NONDISPLAY_CHILD), + (mState & NS_FRAME_IS_NONDISPLAY), "Display lists handle dirty rect intersection test"); nsRect dirtyRect(aDirtyRect->x, aDirtyRect->y, aDirtyRect->width, aDirtyRect->height); @@ -3529,7 +3533,7 @@ nsSVGTextFrame2::GetFrameForPoint(const nsPoint& aPoint) { NS_ASSERTION(GetFirstPrincipalChild(), "must have a child frame"); - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { // Text frames inside will never have had ReflowSVG called on // them, so call UpdateGlyphPositioning to do this now. (Text frames // inside and other non-display containers will never need to @@ -3581,7 +3585,7 @@ nsSVGTextFrame2::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probaby a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD), + NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { @@ -3693,7 +3697,7 @@ nsSVGTextFrame2::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, gfxMatrix nsSVGTextFrame2::GetCanvasTM(uint32_t aFor) { - if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) { return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this); @@ -4734,6 +4738,12 @@ nsSVGTextFrame2::DoGlyphPositioning() mPositions.Clear(); RemoveStateBits(NS_STATE_SVG_POSITIONING_DIRTY); + nsIFrame* kid = GetFirstPrincipalChild(); + if (kid && NS_SUBTREE_DIRTY(kid)) { + MOZ_ASSERT(false, "should have already reflowed the kid"); + return; + } + // Determine the positions of each character in app units. nsTArray charPositions; DetermineCharPositions(charPositions); @@ -4901,7 +4911,7 @@ nsSVGTextFrame2::ShouldRenderAsPath(nsRenderingContext* aContext, void nsSVGTextFrame2::ScheduleReflowSVG() { - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { ScheduleReflowSVGNonDisplayText(); } else { nsSVGUtils::ScheduleReflowSVG(this); @@ -4925,7 +4935,6 @@ nsSVGTextFrame2::UpdateGlyphPositioning() } if (mState & NS_STATE_SVG_POSITIONING_DIRTY) { - MOZ_ASSERT(!NS_SUBTREE_DIRTY(kid), "should have already reflowed the kid"); DoGlyphPositioning(); } } @@ -4962,7 +4971,7 @@ nsSVGTextFrame2::DoReflow() // need to update mPositions. AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY); - if (mState & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (mState & NS_FRAME_IS_NONDISPLAY) { // Normally, these dirty flags would be cleared in ReflowSVG(), but that // doesn't get called for non-display frames. We don't want to reflow our // descendants every time nsSVGTextFrame2::PaintSVG makes sure that we have @@ -5068,7 +5077,7 @@ nsSVGTextFrame2::UpdateFontSizeScaleFactor() // get stuck with a font size scale factor based on whichever referencing // frame happens to reflow first. double contextScale = 1.0; - if (!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(mState & NS_FRAME_IS_NONDISPLAY)) { gfxMatrix m(GetCanvasTM(FOR_OUTERSVG_TM)); if (!m.IsSingular()) { contextScale = GetContextScale(m); diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 3e693557b69c..50fdceb7680b 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -481,7 +481,7 @@ nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) // calls InvalidateBounds) or nsSVGDisplayContainerFrame::InsertFrames // (at which point the frame has no observers). - if (aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) { + if (aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) { return; } @@ -624,7 +624,7 @@ nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect) nsISVGChildFrame* svg = do_QueryFrame(aFrame); if (!svg) return nullptr; - *aRect = (aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) ? + *aRect = (aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) ? nsRect(0, 0, 0, 0) : svg->GetCoveredRegion(); return GetOuterSVGFrame(aFrame); } @@ -638,7 +638,7 @@ nsSVGUtils::GetCanvasTM(nsIFrame *aFrame, uint32_t aFor) return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(aFrame); } - if (!(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { if ((aFor == nsISVGChildFrame::FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) || (aFor == nsISVGChildFrame::FOR_HIT_TESTING && @@ -744,7 +744,7 @@ nsSVGUtils::PaintFrameWithEffects(nsRenderingContext *aContext, nsIFrame *aFrame) { NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || - (aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD) || + (aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) || aFrame->PresContext()->IsGlyph(), "If display lists are enabled, only painting of non-display " "SVG should take this code path"); @@ -773,7 +773,7 @@ nsSVGUtils::PaintFrameWithEffects(nsRenderingContext *aContext, nsSVGFilterFrame *filterFrame = effectProperties.GetFilterFrame(&isOK); if (aDirtyRect && - !(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + !(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { // Here we convert aFrame's paint bounds to outer- device space, // compare it to aDirtyRect, and return early if they don't intersect. // We don't do this optimization for nondisplay SVG since nondisplay @@ -844,7 +844,7 @@ nsSVGUtils::PaintFrameWithEffects(nsRenderingContext *aContext, if (opacity != 1.0f || maskFrame || (clipPathFrame && !isTrivialClip)) { complexEffects = true; gfx->Save(); - if (!(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { + if (!(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { // aFrame has a valid visual overflow rect, so clip to it before calling // PushGroup() to minimize the size of the surfaces we'll composite: gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx); @@ -1277,7 +1277,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame) return true; } const nsStyleSVG *style = aFrame->StyleSVG(); - if (style->mMarkerStart || style->mMarkerMid || style->mMarkerEnd) { + if (style->HasMarker()) { return false; } if (style->mFill.mType == eStyleSVGPaintType_None || diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index 9d8f37e7a6d3..1300bb8dceeb 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -63,11 +63,8 @@ class Element; // SVG Frame state bits #define NS_STATE_IS_OUTER_SVG NS_FRAME_STATE_BIT(20) -/* are we the child of a non-display container? */ -#define NS_STATE_SVG_NONDISPLAY_CHILD NS_FRAME_STATE_BIT(21) - // If this bit is set, we are a element or descendant. -#define NS_STATE_SVG_CLIPPATH_CHILD NS_FRAME_STATE_BIT(22) +#define NS_STATE_SVG_CLIPPATH_CHILD NS_FRAME_STATE_BIT(21) /** * For text, the NS_FRAME_IS_DIRTY and NS_FRAME_HAS_DIRTY_CHILDREN bits indicate @@ -79,7 +76,7 @@ class Element; * to allow us to avoid reflowing the anonymous block when it is not * necessary. */ -#define NS_STATE_SVG_POSITIONING_DIRTY NS_FRAME_STATE_BIT(23) +#define NS_STATE_SVG_POSITIONING_DIRTY NS_FRAME_STATE_BIT(22) /** * For text, whether the values from x/y/dx/dy attributes have any percentage values @@ -104,7 +101,7 @@ class Element; * NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES would require extra work that is * probably not worth it. */ -#define NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES NS_FRAME_STATE_BIT(24) +#define NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES NS_FRAME_STATE_BIT(23) /** * Byte offsets of channels in a native packed gfxColor or cairo image surface. @@ -319,7 +316,7 @@ class nsSVGUtils * Schedules an update of the frame's bounds (which will in turn invalidate * the new area that the frame should paint to). * - * This does nothing when passed an NS_STATE_SVG_NONDISPLAY_CHILD frame. + * This does nothing when passed an NS_FRAME_IS_NONDISPLAY frame. * In future we may want to allow ReflowSVG to be called on such frames, * but that would be better implemented as a ForceReflowSVG function to * be called synchronously while painting them without marking or paying @@ -341,7 +338,7 @@ class nsSVGUtils * mark descendants dirty would cause it to descend through * nsSVGForeignObjectFrame frames to mark their children dirty, but we want to * handle nsSVGForeignObjectFrame specially. It would also do unnecessary work - * descending into NS_STATE_SVG_NONDISPLAY_CHILD frames. + * descending into NS_FRAME_IS_NONDISPLAY frames. */ static void ScheduleReflowSVG(nsIFrame *aFrame); diff --git a/layout/tables/FixedTableLayoutStrategy.cpp b/layout/tables/FixedTableLayoutStrategy.cpp index 3404a353531a..ad686f15231f 100644 --- a/layout/tables/FixedTableLayoutStrategy.cpp +++ b/layout/tables/FixedTableLayoutStrategy.cpp @@ -251,8 +251,22 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt nsIFrame::IntrinsicWidthOffsetData offsets = cellFrame->IntrinsicWidthOffsets(aReflowState.rendContext); float pct = styleWidth->GetPercentValue(); - colWidth = NSToCoordFloor(pct * float(tableWidth)) + - offsets.hPadding + offsets.hBorder; + colWidth = NSToCoordFloor(pct * float(tableWidth)); + + nscoord boxSizingAdjust = 0; + switch (cellFrame->StylePosition()->mBoxSizing) { + case NS_STYLE_BOX_SIZING_CONTENT: + boxSizingAdjust += offsets.hPadding; + // Fall through + case NS_STYLE_BOX_SIZING_PADDING: + boxSizingAdjust += offsets.hBorder; + // Fall through + case NS_STYLE_BOX_SIZING_BORDER: + // Don't add anything + break; + } + colWidth += boxSizingAdjust; + pct /= float(colSpan); colFrame->AddPrefPercent(pct); pctTotal += pct; diff --git a/layout/tables/Makefile.in b/layout/tables/Makefile.in index bce41cf36f37..6b326a4baa1e 100644 --- a/layout/tables/Makefile.in +++ b/layout/tables/Makefile.in @@ -14,9 +14,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk DEFINES += -DDEBUG_TABLE_STRATEGY_off -D_IMPL_NS_LAYOUT diff --git a/layout/xul/base/src/Makefile.in b/layout/xul/base/src/Makefile.in index 25bd6f144cda..7a5b161be309 100644 --- a/layout/xul/base/src/Makefile.in +++ b/layout/xul/base/src/Makefile.in @@ -16,9 +16,6 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/config.mk -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ diff --git a/layout/xul/grid/Makefile.in b/layout/xul/grid/Makefile.in index 964a8fb1daed..6ecbd6a0614e 100644 --- a/layout/xul/grid/Makefile.in +++ b/layout/xul/grid/Makefile.in @@ -21,9 +21,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../forms \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk DEFINES += -D_IMPL_NS_LAYOUT diff --git a/layout/xul/tree/Makefile.in b/layout/xul/tree/Makefile.in index 629c90245c09..5c80cd85e3de 100644 --- a/layout/xul/tree/Makefile.in +++ b/layout/xul/tree/Makefile.in @@ -24,9 +24,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../forms \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk DEFINES += -D_IMPL_NS_LAYOUT diff --git a/media/mtransport/test/ice_unittest.cpp b/media/mtransport/test/ice_unittest.cpp index 54fcea953d62..dd2cef229de1 100644 --- a/media/mtransport/test/ice_unittest.cpp +++ b/media/mtransport/test/ice_unittest.cpp @@ -280,17 +280,17 @@ class IceTestPeer : public sigslot::has_slots<> { } void GotCandidate(NrIceMediaStream *stream, const std::string &candidate) { - std::cout << "Got candidate " << candidate << std::endl; + std::cerr << "Got candidate " << candidate << std::endl; candidates_[stream->name()].push_back(candidate); } void StreamReady(NrIceMediaStream *stream) { - std::cout << "Stream ready " << stream->name() << std::endl; + std::cerr << "Stream ready " << stream->name() << std::endl; ++ready_ct_; } void IceCompleted(NrIceCtx *ctx) { - std::cout << "ICE completed " << name_ << std::endl; + std::cerr << "ICE completed " << name_ << std::endl; ice_complete_ = true; } @@ -413,6 +413,21 @@ class IceConnectTest : public ::testing::Test { ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(), 5000); } + + void ConnectP1(TrickleMode mode = TRICKLE_NONE) { + p1_->Connect(p2_, mode); + } + + void ConnectP2(TrickleMode mode = TRICKLE_NONE) { + p2_->Connect(p1_, mode); + } + + void WaitForComplete(int expected_streams = 1) { + ASSERT_TRUE_WAIT(p1_->ready_ct() == expected_streams && + p2_->ready_ct() == expected_streams, 5000); + ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(), 5000); + } + void ConnectTrickle() { p1_->Connect(p2_, TRICKLE_DEFERRED); p2_->Connect(p1_, TRICKLE_DEFERRED); @@ -425,6 +440,14 @@ class IceConnectTest : public ::testing::Test { ASSERT_TRUE_WAIT(p2_->is_ready(stream), 5000); } + void DoTrickleP1(size_t stream) { + p1_->DoTrickle(stream); + } + + void DoTrickleP2(size_t stream) { + p2_->DoTrickle(stream); + } + void VerifyConnected() { } @@ -539,6 +562,40 @@ TEST_F(IceConnectTest, TestConnect) { Connect(); } +TEST_F(IceConnectTest, TestConnectP2ThenP1) { + AddStream("first", 1); + ASSERT_TRUE(Gather(true)); + ConnectP2(); + PR_Sleep(1000); + ConnectP1(); + WaitForComplete(); +} + +TEST_F(IceConnectTest, TestConnectP2ThenP1Trickle) { + AddStream("first", 1); + ASSERT_TRUE(Gather(true)); + ConnectP2(); + PR_Sleep(1000); + ConnectP1(TRICKLE_DEFERRED); + DoTrickleP1(0); + WaitForComplete(); +} + +TEST_F(IceConnectTest, TestConnectP2ThenP1TrickleTwoComponents) { + AddStream("first", 1); + AddStream("second", 2); + ASSERT_TRUE(Gather(true)); + ConnectP2(); + PR_Sleep(1000); + ConnectP1(TRICKLE_DEFERRED); + DoTrickleP1(0); + std::cerr << "Sleeping between trickle streams" << std::endl; + PR_Sleep(1000); // Give this some time to settle but not complete + // all of ICE. + DoTrickleP1(1); + WaitForComplete(2); +} + TEST_F(IceConnectTest, TestConnectAutoPrioritize) { Init(false); AddStream("first", 1); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c index 46765f328a6e..5082a8aa1564 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c @@ -53,9 +53,6 @@ int nr_ice_candidate_pair_create(nr_ice_peer_ctx *pctx, nr_ice_candidate *lcand, { nr_ice_cand_pair *pair=0; UINT8 o_priority, a_priority; - char *lufrag,*rufrag; - char *lpwd,*rpwd; - char *l2ruser=0,*r2lpass=0; int r,_status; UINT4 RTO; nr_ice_candidate tmpcand; @@ -98,17 +95,6 @@ int nr_ice_candidate_pair_create(nr_ice_peer_ctx *pctx, nr_ice_candidate *lcand, rcand->foundation,NULL)) ABORT(r); - - /* OK, now the STUN data */ - lufrag=lcand->stream->ufrag?lcand->stream->ufrag:pctx->ctx->ufrag; - lpwd=lcand->stream->pwd?lcand->stream->pwd:pctx->ctx->pwd; - assert(lufrag); - assert(lpwd); - rufrag=rcand->stream->ufrag?rcand->stream->ufrag:pctx->peer_ufrag; - rpwd=rcand->stream->pwd?rcand->stream->pwd:pctx->peer_pwd; - if (!rufrag || !rpwd) - ABORT(R_BAD_DATA); - /* Compute the RTO per S 16 */ RTO = MAX(100, (pctx->ctx->Ta * pctx->waiting_pairs)); @@ -121,38 +107,27 @@ int nr_ice_candidate_pair_create(nr_ice_peer_ctx *pctx, nr_ice_candidate *lcand, t_priority = tmpcand.priority; /* Our sending context */ - if(r=nr_concat_strings(&l2ruser,rufrag,":",lufrag,NULL)) - ABORT(r); if(r=nr_stun_client_ctx_create(pair->as_string, lcand->osock, &rcand->addr,RTO,&pair->stun_client)) ABORT(r); - if(!(pair->stun_client->params.ice_binding_request.username=r_strdup(l2ruser))) + if(!(pair->stun_client->params.ice_binding_request.username=r_strdup(rcand->stream->l2r_user))) ABORT(R_NO_MEMORY); - if(r=r_data_make(&pair->stun_client->params.ice_binding_request.password,(UCHAR *)rpwd,strlen(rpwd))) + if(r=r_data_copy(&pair->stun_client->params.ice_binding_request.password, + &rcand->stream->l2r_pass)) ABORT(r); pair->stun_client->params.ice_binding_request.priority=t_priority; + /* TODO(ekr@rtfm.com): Do we need to frob this when we change role. Bug 890667 */ pair->stun_client->params.ice_binding_request.control = pctx->controlling? NR_ICE_CONTROLLING:NR_ICE_CONTROLLED; + pair->stun_client->params.ice_use_candidate.priority=t_priority; pair->stun_client->params.ice_binding_request.tiebreaker=pctx->tiebreaker; - /* Our receiving username/passwords. Stash these for later - injection into the stun server ctx*/ - if(r=nr_concat_strings(&pair->r2l_user,lufrag,":",rufrag,NULL)) - ABORT(r); - if(!(r2lpass=r_strdup(lpwd))) - ABORT(R_NO_MEMORY); - INIT_DATA(pair->r2l_pwd,(UCHAR *)r2lpass,strlen(r2lpass)); - // Give up ownership of r2lpass - r2lpass=0; - *pairp=pair; _status=0; abort: - RFREE(l2ruser); - RFREE(r2lpass); if(_status){ nr_ice_candidate_pair_destroy(&pair); } @@ -178,9 +153,6 @@ int nr_ice_candidate_pair_destroy(nr_ice_cand_pair **pairp) nr_stun_client_ctx_destroy(&pair->stun_client); } - RFREE(pair->r2l_user); - RFREE(pair->r2l_pwd.data); - NR_async_timer_cancel(pair->stun_cb_timer); NR_async_timer_cancel(pair->restart_controlled_cb_timer); NR_async_timer_cancel(pair->restart_nominated_cb_timer); @@ -559,7 +531,6 @@ void nr_ice_candidate_pair_restart_stun_nominated_cb(NR_SOCKET s, int how, void r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/STREAM(%s):%d: Restarting pair %s as nominated",pair->pctx->label,pair->local->stream->label,pair->remote->component->component_id,pair->as_string); nr_stun_client_reset(pair->stun_client); - pair->stun_client->params.ice_binding_request.control=NR_ICE_CONTROLLING; if(r=nr_stun_client_start(pair->stun_client,NR_ICE_CLIENT_MODE_USE_CANDIDATE,nr_ice_candidate_pair_stun_cb,pair)) ABORT(r); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h index 52c14ef4d96b..bb6f26bafbba 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.h @@ -61,9 +61,6 @@ struct nr_ice_cand_pair_ { nr_ice_candidate *remote; /* The remote candidate */ char *foundation; /* The combined foundations */ - char *r2l_user; /* Stashed username */ - Data r2l_pwd; /* Stashed password */ - nr_stun_client_ctx *stun_client; /* STUN context when acting as a client */ void *stun_client_handle; diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_component.c b/media/mtransport/third_party/nICEr/src/ice/ice_component.c index f59279520bc7..68942c5ff425 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c @@ -46,6 +46,59 @@ static char *RCSSTRING __UNUSED__="$Id: ice_component.c,v 1.2 2008/04/28 17:59:0 #include "nr_socket_turn.h" #include "ice_reg.h" +static int nr_ice_component_stun_server_default_cb(void *cb_arg,nr_stun_server_ctx *stun_ctx,nr_socket *sock, nr_stun_server_request *req, int *dont_free, int *error); +static int nr_ice_pre_answer_request_destroy(nr_ice_pre_answer_request **parp); + +/* This function takes ownership of the contents of req (but not req itself) */ +static int nr_ice_pre_answer_request_create(nr_socket *sock, nr_stun_server_request *req, nr_ice_pre_answer_request **parp) + { + int r, _status; + nr_ice_pre_answer_request *par = 0; + nr_stun_message_attribute *attr; + + if (!(par = RCALLOC(sizeof(nr_ice_pre_answer_request)))) + ABORT(R_NO_MEMORY); + + par->req = *req; /* Struct assignment */ + memset(req, 0, sizeof(*req)); /* Zero contents to avoid confusion */ + + if (r=nr_socket_getaddr(sock, &par->local_addr)) + ABORT(r); + if (!nr_stun_message_has_attribute(par->req.request, NR_STUN_ATTR_USERNAME, &attr)) + ABORT(R_INTERNAL); + if (!(par->username = r_strdup(attr->u.username))) + ABORT(R_NO_MEMORY); + + *parp=par; + _status=0; + abort: + if (_status) { + /* Erase the request so we don't free it */ + memset(&par->req, 0, sizeof(nr_stun_server_request)); + nr_ice_pre_answer_request_destroy(&par); + } + + return(_status); + } + +static int nr_ice_pre_answer_request_destroy(nr_ice_pre_answer_request **parp) + { + nr_ice_pre_answer_request *par; + + if (!parp || !*parp) + return(0); + + par = *parp; + *parp = 0; + + nr_stun_message_destroy(&par->req.request); + nr_stun_message_destroy(&par->req.response); + + RFREE(par->username); + + return(0); + } + int nr_ice_component_create(nr_ice_media_stream *stream, int component_id, nr_ice_component **componentp) { int _status; @@ -54,13 +107,15 @@ int nr_ice_component_create(nr_ice_media_stream *stream, int component_id, nr_ic if(!(comp=RCALLOC(sizeof(nr_ice_component)))) ABORT(R_NO_MEMORY); - comp->state=NR_ICE_COMPONENT_RUNNING; + comp->state=NR_ICE_COMPONENT_UNPAIRED; comp->component_id=component_id; comp->stream=stream; comp->ctx=stream->ctx; STAILQ_INIT(&comp->sockets); TAILQ_INIT(&comp->candidates); + STAILQ_INIT(&comp->pre_answer_reqs); + STAILQ_INSERT_TAIL(&stream->components,comp,entry); _status=0; @@ -73,6 +128,7 @@ int nr_ice_component_destroy(nr_ice_component **componentp) nr_ice_component *component; nr_ice_socket *s1,*s2; nr_ice_candidate *c1,*c2; + nr_ice_pre_answer_request *r1,*r2; if(!componentp || !*componentp) return(0); @@ -89,7 +145,6 @@ int nr_ice_component_destroy(nr_ice_component **componentp) } } - /* candidates MUST be destroyed before the sockets so that they can deregister */ TAILQ_FOREACH_SAFE(c1, &component->candidates, entry_comp, c2){ @@ -102,6 +157,11 @@ int nr_ice_component_destroy(nr_ice_component **componentp) nr_ice_socket_destroy(&s1); } + STAILQ_FOREACH_SAFE(r1, &component->pre_answer_reqs, entry, r2){ + STAILQ_REMOVE(&component->pre_answer_reqs,r1,nr_ice_pre_answer_request_, entry); + nr_ice_pre_answer_request_destroy(&r1); + } + if(component->keepalive_timer) NR_async_timer_cancel(component->keepalive_timer); nr_stun_client_ctx_destroy(&component->keepalive_ctx); @@ -119,6 +179,9 @@ int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *compon nr_socket *sock; nr_ice_socket *isock=0; nr_ice_candidate *cand=0; + char *lufrag; + char *lpwd; + Data pwd; int addr_ct; int i; int j; @@ -221,6 +284,22 @@ int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *compon ABORT(r); if(r=nr_ice_socket_register_stun_server(isock,isock->stun_server,&isock->stun_server_handle)) ABORT(r); + /* Add the default STUN credentials so that we can respond before + we hear about the peer. Note: we need to recompute these because + we have not yet computed the values in the peer media stream.*/ + lufrag=component->stream->ufrag ? component->stream->ufrag : ctx->ufrag; + assert(lufrag); + if (!lufrag) + ABORT(R_INTERNAL); + lpwd=component->stream->pwd ? component->stream->pwd :ctx->pwd; + assert(lpwd); + if (!lpwd) + ABORT(R_INTERNAL); + + INIT_DATA(pwd, (UCHAR *)lpwd, strlen(lpwd)); + + if(r=nr_stun_server_add_default_client(isock->stun_server, lufrag, &pwd, nr_ice_component_stun_server_default_cb, component)) + ABORT(r); STAILQ_INSERT_TAIL(&component->sockets,isock,entry); } @@ -329,12 +408,10 @@ int nr_ice_component_prune_candidates(nr_ice_ctx *ctx, nr_ice_component *comp) } /* Section 7.2.1 */ -static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun_ctx,nr_socket *sock, nr_stun_server_request *req, int *error) +static int nr_ice_component_process_incoming_check(nr_ice_component *comp, nr_transport_addr *local_addr, nr_stun_server_request *req, int *error) { - nr_ice_component *comp=cb_arg; nr_ice_cand_pair *pair; nr_ice_candidate *pcand=0; - nr_transport_addr local_addr; nr_stun_message *sreq=req->request; nr_stun_message_attribute *attr; int component_id_matched; @@ -343,8 +420,6 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun nr_ice_cand_pair *found_invalid=0; int r=0,_status; - assert(sock!=0); - r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/STREAM(%s)(%d): received request from %s",comp->stream->pctx->label,comp->stream->label,comp->component_id,req->src_addr.as_string); /* Check for role conficts (7.2.1.1) */ @@ -389,13 +464,7 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun } } - /* Find the candidate pair that this maps to */ - if(r=nr_socket_getaddr(sock,&local_addr)) { - *error=500; - ABORT(r); - } - - r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): This STUN request appears to map to local addr %s",comp->stream->pctx->label,local_addr.as_string); + r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): This STUN request appears to map to local addr %s",comp->stream->pctx->label,local_addr->as_string); pair=TAILQ_FIRST(&comp->stream->check_list); while(pair){ @@ -407,7 +476,7 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun goto next_pair; component_id_matched = 1; - if(nr_transport_addr_cmp(&pair->local->base,&local_addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)) + if(nr_transport_addr_cmp(&pair->local->base,local_addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)) goto next_pair; local_addr_matched=1; @@ -438,7 +507,7 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): no matching pair",comp->stream->pctx->label); cand=TAILQ_FIRST(&comp->local_component->candidates); while(cand){ - if(!nr_transport_addr_cmp(&cand->addr,&local_addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)) + if(!nr_transport_addr_cmp(&cand->addr,local_addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)) break; cand=TAILQ_NEXT(cand,entry_comp); @@ -447,7 +516,7 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun /* Well, this really shouldn't happen, but it's an error from the other side, so we just throw an error and keep going */ if(!cand){ - r_log(LOG_ICE,LOG_WARNING,"ICE-PEER(%s): stun request to unknown local address %s, discarding",comp->stream->pctx->label,local_addr.as_string); + r_log(LOG_ICE,LOG_WARNING,"ICE-PEER(%s): stun request to unknown local address %s, discarding",comp->stream->pctx->label,local_addr->as_string); *error=400; ABORT(R_NOT_FOUND); @@ -536,6 +605,57 @@ static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun return(_status); } +static int nr_ice_component_stun_server_cb(void *cb_arg,nr_stun_server_ctx *stun_ctx,nr_socket *sock, nr_stun_server_request *req, int *dont_free, int *error) + { + nr_ice_component *comp=cb_arg; + nr_transport_addr local_addr; + int r,_status; + + /* Find the candidate pair that this maps to */ + if(r=nr_socket_getaddr(sock,&local_addr)) { + *error=500; + ABORT(r); + } + + if (r=nr_ice_component_process_incoming_check(comp, &local_addr, req, error)) + ABORT(r); + + _status=0; + abort: + return(_status); + } + +int nr_ice_component_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, char *username, int *serviced) + { + nr_ice_pre_answer_request *r1,*r2; + nr_ice_component *comp = pcomp->local_component; + int r,_status; + + if (serviced) + *serviced = 0; + + r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/STREAM(%s)/comp(%d): looking for pre-answer requests",pctx->label,comp->stream->label,comp->component_id); + + STAILQ_FOREACH_SAFE(r1, &comp->pre_answer_reqs, entry, r2) { + if (!strcmp(r1->username, username)) { + int error = 0; + + r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/STREAM(%s)/comp(%d): found pre-answer request",pctx->label,comp->stream->label,comp->component_id); + r = nr_ice_component_process_incoming_check(pcomp, &r1->local_addr, &r1->req, &error); + if (r) { + r_log(LOG_ICE,LOG_INFO,"ICE-PEER(%s)/STREAM(%s)/comp(%d): error processing pre-answer request. Would have returned %d",pctx->label,comp->stream->label,comp->component_id, error); + } + (*serviced)++; + STAILQ_REMOVE(&comp->pre_answer_reqs,r1,nr_ice_pre_answer_request_, entry); + nr_ice_pre_answer_request_destroy(&r1); + } + } + + _status=0; + abort: + return(_status); + } + int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp,nr_ice_component *pcomp) { nr_ice_candidate *lcand,*pcand; @@ -603,21 +723,6 @@ int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lc if(!pair) goto next_cand; - if (!was_paired) { - /* Add the stun username/password pair from the last pair (any - would do) to the stun contexts, but only if we haven't already - done so (was_paired) */ - isock=STAILQ_FIRST(&lcomp->sockets); - while(isock){ - if(r=nr_stun_server_add_client(isock->stun_server,pctx->label, - pair->r2l_user,&pair->r2l_pwd,nr_ice_component_stun_server_cb,pcomp)) { - ABORT(r); - } - - isock=STAILQ_NEXT(isock,entry); - } - } - next_cand: lcand=TAILQ_NEXT(lcand,entry_comp); } @@ -628,13 +733,55 @@ int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lc pcand->state = NR_ICE_CAND_PEER_CANDIDATE_PAIRED; pcand=TAILQ_NEXT(pcand,entry_comp); + } + /* Now register the STUN server callback for this component. + Note that this is a per-component CB so we only need to + do this once. + */ + if (pcomp->state != NR_ICE_COMPONENT_RUNNING) { + isock=STAILQ_FIRST(&lcomp->sockets); + while(isock){ + if(r=nr_stun_server_add_client(isock->stun_server,pctx->label, + pcomp->stream->r2l_user,&pcomp->stream->r2l_pass,nr_ice_component_stun_server_cb,pcomp)) { + ABORT(r); + } + isock=STAILQ_NEXT(isock,entry); + } + } + + pcomp->state = NR_ICE_COMPONENT_RUNNING; + _status=0; abort: return(_status); } +/* Fires when we have an incoming candidate that doesn't correspond to an existing + remote peer. This is either pre-answer or just spurious. Store it in the + component for use when we see the actual answer, at which point we need + to do the procedures from S 7.2.1 in nr_ice_component_stun_server_cb. + */ +static int nr_ice_component_stun_server_default_cb(void *cb_arg,nr_stun_server_ctx *stun_ctx,nr_socket *sock, nr_stun_server_request *req, int *dont_free, int *error) + { + int r, _status; + nr_ice_component *comp = (nr_ice_component *)cb_arg; + nr_ice_pre_answer_request *par = 0; + r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/STREAM(%s)/comp(%d): Received STUN request pre-answer from %s", + comp->ctx->label, comp->stream->label, comp->component_id, req->src_addr.as_string); + + if (r=nr_ice_pre_answer_request_create(sock, req, &par)) + ABORT(r); + + *dont_free = 1; + STAILQ_INSERT_TAIL(&comp->pre_answer_reqs, par, entry); + + _status=0; + abort: + return 0; + } + int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair) { int r,_status; diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_component.h b/media/mtransport/third_party/nICEr/src/ice/ice_component.h index 7cd5d7aa6a56..543460b800c5 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_component.h +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.h @@ -39,8 +39,19 @@ using namespace std; extern "C" { #endif /* __cplusplus */ +typedef struct nr_ice_pre_answer_request_ { + nr_stun_server_request req; + char *username; + nr_transport_addr local_addr; + + STAILQ_ENTRY(nr_ice_pre_answer_request_) entry; +} nr_ice_pre_answer_request; + +typedef STAILQ_HEAD(nr_ice_pre_answer_request_head_, nr_ice_pre_answer_request_) nr_ice_pre_answer_request_head; + struct nr_ice_component_ { int state; +#define NR_ICE_COMPONENT_UNPAIRED 0 #define NR_ICE_COMPONENT_RUNNING 1 #define NR_ICE_COMPONENT_NOMINATED 2 #define NR_ICE_COMPONENT_FAILED 3 @@ -52,6 +63,7 @@ struct nr_ice_component_ { nr_ice_socket_head sockets; nr_ice_candidate_head candidates; int candidate_ct; + nr_ice_pre_answer_request_head pre_answer_reqs; int valid_pairs; struct nr_ice_cand_pair_ *nominated; /* Highest priority nomninated pair */ @@ -71,6 +83,7 @@ int nr_ice_component_destroy(nr_ice_component **componentp); int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *component); int nr_ice_component_prune_candidates(nr_ice_ctx *ctx, nr_ice_component *comp); int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp,nr_ice_component *pcomp); +int nr_ice_component_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, char *username, int *serviced); int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); int nr_ice_component_failed_pair(nr_ice_component *comp, nr_ice_cand_pair *pair); int nr_ice_component_select_pair(nr_ice_peer_ctx *pctx, nr_ice_component *comp); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c index fba5353e24be..1804b5196e6e 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c @@ -39,6 +39,7 @@ static char *RCSSTRING __UNUSED__="$Id: ice_media_stream.c,v 1.2 2008/04/28 17:5 #include #include #include +#include "ice_util.h" #include "ice_ctx.h" static char *nr_ice_media_stream_states[]={"INVALID", @@ -109,6 +110,10 @@ int nr_ice_media_stream_destroy(nr_ice_media_stream **streamp) RFREE(stream->ufrag); RFREE(stream->pwd); + RFREE(stream->r2l_user); + RFREE(stream->l2r_user); + r_data_zfree(&stream->r2l_pass); + r_data_zfree(&stream->l2r_pass); if(stream->timer) NR_async_timer_cancel(stream->timer); @@ -277,8 +282,7 @@ int nr_ice_media_stream_pair_candidates(nr_ice_peer_ctx *pctx,nr_ice_media_strea }; if (pstream->ice_state == NR_ICE_MEDIA_STREAM_UNPAIRED) { - r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s): unfreezing stream %s",pstream->pctx->label,pstream->label); - pstream->ice_state = NR_ICE_MEDIA_STREAM_CHECKS_FROZEN; + nr_ice_media_stream_set_state(pstream, NR_ICE_MEDIA_STREAM_CHECKS_FROZEN); } _status=0; @@ -286,6 +290,35 @@ int nr_ice_media_stream_pair_candidates(nr_ice_peer_ctx *pctx,nr_ice_media_strea return(_status); } +int nr_ice_media_stream_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_media_stream *lstream, nr_ice_media_stream *pstream, int *serviced) + { + nr_ice_component *pcomp; + int r,_status; + char *user = 0; + char *lufrag, *rufrag; + + if (serviced) + *serviced = 0; + + pcomp=STAILQ_FIRST(&pstream->components); + while(pcomp){ + int serviced_inner=0; + + /* Flush all the pre-answer requests */ + if(r=nr_ice_component_service_pre_answer_requests(pctx, pcomp, pstream->r2l_user, &serviced_inner)) + ABORT(r); + if (serviced) + *serviced += serviced_inner; + + pcomp=STAILQ_NEXT(pcomp,entry); + } + + _status=0; + abort: + RFREE(user); + return(_status); + } + /* S 5.8 -- run the highest priority WAITING pair or if not available FROZEN pair */ static void nr_ice_media_stream_check_timer_cb(NR_SOCKET s, int h, void *cb_arg) diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h index 2b7828caf3c3..eeabce63a8ae 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h +++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h @@ -50,7 +50,10 @@ struct nr_ice_media_stream_ { char *ufrag; /* ICE username */ char *pwd; /* ICE password */ - + char *r2l_user; /* The username for incoming requests */ + char *l2r_user; /* The username for outgoing requests */ + Data r2l_pass; /* The password for incoming requests */ + Data l2r_pass; /* The password for outcoming requests */ int ice_state; #define NR_ICE_MEDIA_STREAM_UNPAIRED 1 @@ -77,6 +80,7 @@ int nr_ice_media_stream_get_attributes(nr_ice_media_stream *stream, char ***attr int nr_ice_media_stream_get_default_candidate(nr_ice_media_stream *stream, int component, nr_ice_candidate **candp); int nr_ice_media_stream_pair_candidates(nr_ice_peer_ctx *pctx,nr_ice_media_stream *lstream,nr_ice_media_stream *pstream); int nr_ice_media_stream_start_checks(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream); +int nr_ice_media_stream_service_pre_answer_requests(nr_ice_peer_ctx *pctx,nr_ice_media_stream *lstream,nr_ice_media_stream *pstream, int *serviced); int nr_ice_media_stream_unfreeze_pairs(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream); int nr_ice_media_stream_unfreeze_pairs_foundation(nr_ice_media_stream *stream, char *foundation); int nr_ice_media_stream_dump_state(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream,FILE *out); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c index b5e71b11d080..f0ad48f6dd6d 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c @@ -39,6 +39,8 @@ static char *RCSSTRING __UNUSED__="$Id: ice_peer_ctx.c,v 1.2 2008/04/28 17:59:01 #include #include "ice_ctx.h" #include "ice_peer_ctx.h" +#include "ice_media_stream.h" +#include "ice_util.h" #include "nr_crypto.h" #include "async_timer.h" @@ -98,6 +100,8 @@ int nr_ice_peer_ctx_parse_stream_attributes(nr_ice_peer_ctx *pctx, nr_ice_media_ { nr_ice_media_stream *pstream=0; nr_ice_component *comp,*comp2; + char *lufrag,*rufrag; + char *lpwd,*rpwd; int r,_status; /* @@ -122,6 +126,25 @@ int nr_ice_peer_ctx_parse_stream_attributes(nr_ice_peer_ctx *pctx, nr_ice_media_ if (r=nr_ice_peer_ctx_parse_stream_attributes_int(pctx,stream,pstream,attrs,attr_ct)) ABORT(r); + /* Now that we have the ufrag and password, compute all the username/password + pairs */ + lufrag=stream->ufrag?stream->ufrag:pctx->ctx->ufrag; + lpwd=stream->pwd?stream->pwd:pctx->ctx->pwd; + assert(lufrag); + assert(lpwd); + rufrag=pstream->ufrag?pstream->ufrag:pctx->peer_ufrag; + rpwd=pstream->pwd?pstream->pwd:pctx->peer_pwd; + if (!rufrag || !rpwd) + ABORT(R_BAD_DATA); + + if(r=nr_concat_strings(&pstream->r2l_user,lufrag,":",rufrag,NULL)) + ABORT(r); + if(r=nr_concat_strings(&pstream->l2r_user,rufrag,":",lufrag,NULL)) + ABORT(r); + if(r=r_data_make(&pstream->r2l_pass, (UCHAR *)lpwd, strlen(lpwd))) + ABORT(r); + if(r=r_data_make(&pstream->l2r_pass, (UCHAR *)rpwd, strlen(rpwd))) + ABORT(r); STAILQ_INSERT_TAIL(&pctx->peer_streams,pstream,entry); @@ -207,6 +230,8 @@ int nr_ice_peer_ctx_parse_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_ int r,_status; int needs_pairing = 0; + r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) parsing trickle ICE candidate %s",pctx->ctx->label,pctx->label,candidate); + pstream=STAILQ_FIRST(&pctx->peer_streams); while(pstream) { if (pstream->local_stream == stream) @@ -279,6 +304,9 @@ int nr_ice_peer_ctx_pair_candidates(nr_ice_peer_ctx *pctx) nr_ice_media_stream *stream; int r,_status; + + r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) pairing candidates",pctx->ctx->label,pctx->label); + if(STAILQ_EMPTY(&pctx->peer_streams)) { r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) received no media stream attribributes",pctx->ctx->label,pctx->label); ABORT(R_FAILED); @@ -356,6 +384,7 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first) { int r,_status; nr_ice_media_stream *stream; + int started = 0; stream=STAILQ_FIRST(&pctx->peer_streams); if(!stream) @@ -366,6 +395,16 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first) break; if(!allow_non_first){ + /* This test applies if: + + 1. allow_non_first is 0 (i.e., non-trickle ICE) + 2. the first stream has an empty check list. + + But in the non-trickle ICE case, the other side should have provided + some candidates or ICE is pretty much not going to work and we're + just going to fail. Hence R_FAILED as opposed to R_NOT_FOUND and + immediate termination here. + */ r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) first stream has empty check list",pctx->ctx->label,pctx->label); ABORT(R_FAILED); } @@ -374,15 +413,36 @@ int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first) } if (!stream) { - r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) no streams with non-empty check lists",pctx->ctx->label,pctx->label); - ABORT(R_NOT_FOUND); + r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) no streams with non-empty check lists",pctx->ctx->label,pctx->label); } - - if (stream->ice_state == NR_ICE_MEDIA_STREAM_CHECKS_FROZEN) { + else if (stream->ice_state == NR_ICE_MEDIA_STREAM_CHECKS_FROZEN) { if(r=nr_ice_media_stream_unfreeze_pairs(pctx,stream)) ABORT(r); if(r=nr_ice_media_stream_start_checks(pctx,stream)) ABORT(r); + ++started; + } + + stream=STAILQ_FIRST(&pctx->peer_streams); + while (stream) { + int serviced = 0; + if (r=nr_ice_media_stream_service_pre_answer_requests(pctx, stream->local_stream, stream, &serviced)) + ABORT(r); + + if (serviced) { + ++started; + } + else { + r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) no streams with pre-answer requests",pctx->ctx->label,pctx->label); + } + + + stream=STAILQ_NEXT(stream, entry); + } + + if (!started) { + r_log(LOG_ICE,LOG_NOTICE,"ICE(%s): peer (%s) no checks to start",pctx->ctx->label,pctx->label); + ABORT(R_NOT_FOUND); } _status=0; diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_build.c b/media/mtransport/third_party/nICEr/src/stun/stun_build.c index f84270f4a95e..b97c1e41f6a2 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun_build.c +++ b/media/mtransport/third_party/nICEr/src/stun/stun_build.c @@ -239,6 +239,9 @@ nr_stun_build_use_candidate(nr_stun_client_ice_use_candidate_params *params, nr_ if ((r=nr_stun_message_add_priority_attribute(req, params->priority))) ABORT(r); + if ((r=nr_stun_message_add_ice_controlling_attribute(req, params->tiebreaker))) + ABORT(r); + *msg = req; _status=0; @@ -274,6 +277,9 @@ nr_stun_build_req_ice(nr_stun_client_ice_binding_request_params *params, nr_stun if ((r=nr_stun_message_add_ice_controlled_attribute(req, params->tiebreaker))) ABORT(r); break; + default: + assert(0); + ABORT(R_INTERNAL); } *msg = req; diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_build.h b/media/mtransport/third_party/nICEr/src/stun/stun_build.h index 2f917d5966d2..d84af002477b 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun_build.h +++ b/media/mtransport/third_party/nICEr/src/stun/stun_build.h @@ -79,6 +79,7 @@ typedef struct nr_stun_client_ice_use_candidate_params_ { char *username; Data password; UINT4 priority; + UINT8 tiebreaker; } nr_stun_client_ice_use_candidate_params; int nr_stun_build_use_candidate(nr_stun_client_ice_use_candidate_params *params, nr_stun_message **msg); diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c index 3ae8a5acfcfe..8ec13be9d598 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c +++ b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c @@ -84,17 +84,18 @@ int nr_stun_server_ctx_destroy(nr_stun_server_ctx **ctxp) nr_stun_server_destroy_client(clnt1); } + nr_stun_server_destroy_client(ctx->default_client); + RFREE(ctx->label); RFREE(ctx); return(0); } -int nr_stun_server_add_client(nr_stun_server_ctx *ctx, char *client_label, char *user, Data *pass, int (*stun_server_cb)(void *cb_arg, nr_stun_server_ctx *ctx,nr_socket *sock, nr_stun_server_request *req, int *error), void *cb_arg) +static int nr_stun_server_client_create(nr_stun_server_ctx *ctx, char *client_label, char *user, Data *pass, nr_stun_server_cb cb, void *cb_arg, nr_stun_server_client **clntp) { - int r,_status; - nr_stun_server_client *clnt=0; + int r,_status; if(!(clnt=RCALLOC(sizeof(nr_stun_server_client)))) ABORT(R_NO_MEMORY); @@ -108,19 +109,52 @@ int nr_stun_server_add_client(nr_stun_server_ctx *ctx, char *client_label, char if(r=r_data_copy(&clnt->password,pass)) ABORT(r); - clnt->stun_server_cb=stun_server_cb; + clnt->stun_server_cb=cb; clnt->cb_arg=cb_arg; - STAILQ_INSERT_TAIL(&ctx->clients,clnt,entry); - + *clntp = clnt; _status=0; - abort: + abort: if(_status){ nr_stun_server_destroy_client(clnt); } return(_status); } +int nr_stun_server_add_client(nr_stun_server_ctx *ctx, char *client_label, char *user, Data *pass, nr_stun_server_cb cb, void *cb_arg) + { + int r,_status; + nr_stun_server_client *clnt; + + if (r=nr_stun_server_client_create(ctx, client_label, user, pass, cb, cb_arg, &clnt)) + ABORT(r); + + STAILQ_INSERT_TAIL(&ctx->clients,clnt,entry); + + _status=0; + abort: + return(_status); + } + +int nr_stun_server_add_default_client(nr_stun_server_ctx *ctx, char *ufrag, Data *pass, nr_stun_server_cb cb, void *cb_arg) + { + int r,_status; + nr_stun_server_client *clnt; + + assert(!ctx->default_client); + if (ctx->default_client) + ABORT(R_INTERNAL); + + if (r=nr_stun_server_client_create(ctx, "default_client", ufrag, pass, cb, cb_arg, &clnt)) + ABORT(r); + + ctx->default_client = clnt; + + _status=0; + abort: + return(_status); + } + int nr_stun_server_remove_client(nr_stun_server_ctx *ctx, void *cb_arg) { nr_stun_server_client *clnt1,*clnt2; @@ -200,6 +234,7 @@ int nr_stun_server_process_request(nr_stun_server_ctx *ctx, nr_socket *sock, cha nr_stun_server_client *clnt = 0; nr_stun_server_request info; int error; + int dont_free; r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-SERVER(%s): Received(my_addr=%s,peer_addr=%s)",ctx->label,ctx->my_addr.as_string,peer_addr->as_string); @@ -291,7 +326,8 @@ int nr_stun_server_process_request(nr_stun_server_ctx *ctx, nr_socket *sock, cha info.response = res; error = 0; - if (clnt->stun_server_cb(clnt->cb_arg,ctx,sock,&info,&error)) { + dont_free = 0; + if (clnt->stun_server_cb(clnt->cb_arg,ctx,sock,&info,&dont_free,&error)) { if (error == 0) error = 500; @@ -335,8 +371,10 @@ int nr_stun_server_process_request(nr_stun_server_ctx *ctx, nr_socket *sock, cha _status = 0; } - nr_stun_message_destroy(&res); - nr_stun_message_destroy(&req); + if (!dont_free) { + nr_stun_message_destroy(&res); + nr_stun_message_destroy(&req); + } return(_status); } @@ -375,6 +413,9 @@ static int nr_stun_server_send_response(nr_stun_server_ctx *ctx, nr_socket *sock static int nr_stun_server_destroy_client(nr_stun_server_client *clnt) { + if (!clnt) + return 0; + RFREE(clnt->label); RFREE(clnt->username); r_data_zfree(&clnt->password); @@ -399,6 +440,20 @@ int nr_stun_get_message_client(nr_stun_server_ctx *ctx, nr_stun_message *req, nr sizeof(attr->u.username))) break; } + + if (!clnt && ctx->default_client) { + /* If we can't find a specific client see if this matches the default, + which means that the username starts with our ufrag. + */ + char *colon = strchr(attr->u.username, ':'); + if (colon && !strncmp(ctx->default_client->username, + attr->u.username, + colon - attr->u.username)) { + clnt = ctx->default_client; + r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-SERVER(%s): Falling back to default client, username=: %s",ctx->label,attr->u.username); + } + } + if (!clnt) { r_log(NR_LOG_STUN,LOG_NOTICE,"STUN-SERVER(%s): Request from unknown user: %s",ctx->label,attr->u.username); ABORT(R_NOT_FOUND); diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.h b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.h index 13fa0c76730d..343e676069c5 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.h +++ b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.h @@ -47,11 +47,13 @@ typedef struct nr_stun_server_request_{ nr_stun_message *response; } nr_stun_server_request; +typedef int (*nr_stun_server_cb)(void *cb_arg, struct nr_stun_server_ctx_ *ctx,nr_socket *sock,nr_stun_server_request *req, int *dont_free, int *error); + struct nr_stun_server_client_ { char *label; char *username; Data password; - int (*stun_server_cb)(void *cb_arg, nr_stun_server_ctx *ctx,nr_socket *sock, nr_stun_server_request *req, int *error); + nr_stun_server_cb stun_server_cb; void *cb_arg; char nonce[NR_STUN_MAX_NONCE_BYTES+1]; /* +1 for \0 */ STAILQ_ENTRY(nr_stun_server_client_) entry; @@ -64,13 +66,15 @@ struct nr_stun_server_ctx_ { nr_socket *sock; nr_transport_addr my_addr; nr_stun_server_client_head clients; + nr_stun_server_client *default_client; }; int nr_stun_server_ctx_create(char *label, nr_socket *sock, nr_stun_server_ctx **ctxp); int nr_stun_server_ctx_destroy(nr_stun_server_ctx **ctxp); -int nr_stun_server_add_client(nr_stun_server_ctx *ctx, char *client_label, char *user, Data *pass, int (*stun_server_cb)(void *cb_arg, nr_stun_server_ctx *ctx,nr_socket *sock,nr_stun_server_request *req, int *error), void *cb_arg); +int nr_stun_server_add_client(nr_stun_server_ctx *ctx, char *client_label, char *user, Data *pass, nr_stun_server_cb cb, void *cb_arg); int nr_stun_server_remove_client(nr_stun_server_ctx *ctx, void *cb_arg); +int nr_stun_server_add_default_client(nr_stun_server_ctx *ctx, char *ufrag, Data *pass, nr_stun_server_cb cb, void *cb_arg); int nr_stun_server_process_request(nr_stun_server_ctx *ctx, nr_socket *sock, char *msg, int len, nr_transport_addr *peer_addr, int auth_rule); int nr_stun_get_message_client(nr_stun_server_ctx *ctx, nr_stun_message *req, nr_stun_server_client **clnt); diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 30bbb343eb4c..349945879c00 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -2283,12 +2283,15 @@ TEST_F(SignalingTest, missingUfrag) // FSM. This may change in the future. a1_.CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV); a1_.SetLocal(TestObserver::OFFER, offer, true); + // Really we should detect failure at the SetRemote point, + // since without a ufrag, we aren't going to be successful. + // But for now, this isn't detected till SIPCC tries to impose + // the parameters on the ICE stack in SetLocal. Bug 892161. a2_.SetRemote(TestObserver::OFFER, offer, true); a2_.CreateAnswer(constraints, offer, OFFER_AV | ANSWER_AV); - a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), true); - a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), true); - // We don't check anything in particular for success here -- simply not - // crashing by now is enough to declare success. + a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), + true, sipcc::PeerConnectionImpl::kSignalingHaveRemoteOffer); + // Since things have now failed, just stop. } } // End namespace test. diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 0005de2a9791..8e1ded20c778 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -470,7 +470,7 @@ pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/beta/faq/"); #else pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/faq/"); #endif -pref("app.marketplaceURL", "https://marketplace.mozilla.org/"); +pref("app.marketplaceURL", "https://marketplace.firefox.com/"); // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror) pref("security.alternate_certificate_error_page", "certerror"); @@ -655,7 +655,7 @@ pref("ui.scrolling.axis_lock_mode", "standard"); // Enable accessibility mode if platform accessibility is enabled. pref("accessibility.accessfu.activate", 2); -pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,ListItem"); +pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,Landmark,ListItem"); // Setting for an utterance order (0 - description first, 1 - description last). pref("accessibility.accessfu.utterance", 1); // Whether to skip images with empty alt text diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 4ef27743504d..0cc9d19b6786 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -59,6 +59,7 @@ import android.os.Handler; import android.os.PowerManager; import android.os.StrictMode; +import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.telephony.CellLocation; @@ -1693,7 +1694,8 @@ public void run() { }); restoreMode = RESTORE_NORMAL; - } else if (savedInstanceState != null) { + } else if (savedInstanceState != null || + PreferenceManager.getDefaultSharedPreferences(this).getBoolean(GeckoPreferences.PREFS_RESTORE_SESSION, false)) { restoreMode = RESTORE_NORMAL; } diff --git a/mobile/android/base/GeckoPreferences.java b/mobile/android/base/GeckoPreferences.java index 6a310b64821a..f177e2b7b8f8 100644 --- a/mobile/android/base/GeckoPreferences.java +++ b/mobile/android/base/GeckoPreferences.java @@ -75,6 +75,8 @@ public class GeckoPreferences private static String PREFS_GEO_REPORTING = "app.geo.reportdata"; private static String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link"; + public static String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession"; + // These values are chosen to be distinct from other Activity constants. private static int REQUEST_CODE_PREF_SCREEN = 5; private static int RESULT_CODE_EXIT_SETTINGS = 6; @@ -456,6 +458,10 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { // Translate boolean value to int for geo reporting pref. PrefsHelper.setPref(prefName, (Boolean) newValue ? 1 : 0); return true; + } else if (PREFS_RESTORE_SESSION.equals(prefName)) { + // Do nothing else; the pref will be persisted in the shared prefs, + // and it will be read at startup in Java before a session restore. + return true; } if (!TextUtils.isEmpty(prefName)) { diff --git a/mobile/android/base/LightweightTheme.java b/mobile/android/base/LightweightTheme.java index 30f4b29ffcc6..e36a0419e481 100644 --- a/mobile/android/base/LightweightTheme.java +++ b/mobile/android/base/LightweightTheme.java @@ -7,6 +7,7 @@ import org.mozilla.gecko.gfx.BitmapUtils; import org.mozilla.gecko.util.GeckoEventListener; +import org.mozilla.gecko.util.ThreadUtils; import org.json.JSONObject; @@ -75,17 +76,25 @@ public void handleMessage(String event, JSONObject message) { try { if (event.equals("LightweightTheme:Update")) { JSONObject lightweightTheme = message.getJSONObject("data"); - String headerURL = lightweightTheme.getString("headerURL"); - int mark = headerURL.indexOf('?'); - if (mark != -1) - headerURL = headerURL.substring(0, mark); + final String headerURL = lightweightTheme.getString("headerURL"); - // Get the image and convert it to a bitmap. - final Bitmap bitmap = BitmapUtils.decodeUrl(headerURL); - mHandler.post(new Runnable() { + // Move any heavy lifting off the Gecko thread + ThreadUtils.postToBackgroundThread(new Runnable() { @Override public void run() { - setLightweightTheme(bitmap); + String croppedURL = headerURL; + int mark = croppedURL.indexOf('?'); + if (mark != -1) + croppedURL = croppedURL.substring(0, mark); + + // Get the image and convert it to a bitmap. + final Bitmap bitmap = BitmapUtils.decodeUrl(croppedURL); + mHandler.post(new Runnable() { + @Override + public void run() { + setLightweightTheme(bitmap); + } + }); } }); } else if (event.equals("LightweightTheme:Disable")) { diff --git a/mobile/android/base/WebAppAllocator.java b/mobile/android/base/WebAppAllocator.java index 98f38974101b..406dbe2d5cc1 100644 --- a/mobile/android/base/WebAppAllocator.java +++ b/mobile/android/base/WebAppAllocator.java @@ -18,7 +18,6 @@ public class WebAppAllocator { // The number of WebApp# and WEBAPP# activites/apps/intents private final static int MAX_WEB_APPS = 100; - protected static GeckoApp sContext = null; protected static WebAppAllocator sInstance = null; public static WebAppAllocator getInstance() { return getInstance(GeckoAppShell.getContext()); @@ -26,18 +25,6 @@ public static WebAppAllocator getInstance() { public static synchronized WebAppAllocator getInstance(Context cx) { if (sInstance == null) { - if (!(cx instanceof GeckoApp)) - throw new RuntimeException("Context needs to be a GeckoApp"); - - sContext = (GeckoApp) cx; - sInstance = new WebAppAllocator(cx); - } - - // The marketplaceApp will run in this same process, but has a different context - // Rather than just failing, we want to create a new Allocator instead - if (cx != sContext) { - sInstance = null; - sContext = (GeckoApp) cx; sInstance = new WebAppAllocator(cx); } diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index cdd2e1d2eb5e..de7b3db80474 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -115,6 +115,7 @@ + diff --git a/mobile/android/base/resources/drawable-hdpi/abouthome_thumbnail.png b/mobile/android/base/resources/drawable-hdpi/abouthome_thumbnail.png index 3d544b2243af..870e1f39bf87 100644 Binary files a/mobile/android/base/resources/drawable-hdpi/abouthome_thumbnail.png and b/mobile/android/base/resources/drawable-hdpi/abouthome_thumbnail.png differ diff --git a/mobile/android/base/resources/drawable-mdpi/abouthome_thumbnail.png b/mobile/android/base/resources/drawable-mdpi/abouthome_thumbnail.png index 9ecb1b21db53..e87aa340939e 100644 Binary files a/mobile/android/base/resources/drawable-mdpi/abouthome_thumbnail.png and b/mobile/android/base/resources/drawable-mdpi/abouthome_thumbnail.png differ diff --git a/mobile/android/base/resources/drawable-xhdpi/abouthome_thumbnail.png b/mobile/android/base/resources/drawable-xhdpi/abouthome_thumbnail.png index a1cb3243fe1a..96266ac5be47 100644 Binary files a/mobile/android/base/resources/drawable-xhdpi/abouthome_thumbnail.png and b/mobile/android/base/resources/drawable-xhdpi/abouthome_thumbnail.png differ diff --git a/mobile/android/base/resources/xml/preferences_customize.xml b/mobile/android/base/resources/xml/preferences_customize.xml index f6685543252d..a1494da03d12 100644 --- a/mobile/android/base/resources/xml/preferences_customize.xml +++ b/mobile/android/base/resources/xml/preferences_customize.xml @@ -22,6 +22,11 @@ android:defaultValue="true" android:persistent="false" /> + + &pref_font_size_adjust_char; &pref_font_size_preview_text; &pref_reflow_on_zoom3; + &pref_restore_session; &pref_show_product_announcements; &pref_sync; &pref_search_suggestions; diff --git a/mobile/android/base/tests/testShareLink.java.in b/mobile/android/base/tests/testShareLink.java.in index f843ec6368b0..dd7323f67cac 100644 --- a/mobile/android/base/tests/testShareLink.java.in +++ b/mobile/android/base/tests/testShareLink.java.in @@ -21,6 +21,7 @@ import android.util.DisplayMetrics; public class testShareLink extends BaseTest { ListView list; String url; + String urlTitle = "Big Link"; @Override protected int getTestType() { @@ -33,7 +34,7 @@ public class testShareLink extends BaseTest { blockForGeckoReady(); loadUrl(url); - waitForText("Big Link"); // Waiting for page title to ensure the page is loaded + waitForText(urlTitle); // Waiting for page title to ensure the page is loaded selectMenuItem("Share"); if (Build.VERSION.SDK_INT >= 14) { // Check for our own sync in the submenu. @@ -52,7 +53,7 @@ public class testShareLink extends BaseTest { // Test share from the awesomebar context menu mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Close the share menu - mSolo.clickLongOnText("Big Link"); + mSolo.clickLongOnText(urlTitle); verifySharePopup(shareOptions,"Awesomebar"); // Test link Context Menu @@ -85,18 +86,11 @@ public class testShareLink extends BaseTest { // Test the share popup in the Bookmarks tab ListView blist = getBookmarksList("about:firefox"); - // Make sure we are in the Bookmarks tab - // TODO: understand why this is sometimes necessary - mSolo.clickOnText("Bookmarks"); View bookmark = blist.getChildAt(1); // Getting child at 1 because 0 might be the Desktop folder mSolo.clickLongOnView(bookmark); verifySharePopup(shareOptions,"bookmarks"); // Test the share popup in the History tab - clickOnAwesomeBar(); - // Make sure we are in the History tab - // TODO: understand why this is sometimes necessary - mSolo.clickOnText("History"); ListView hlist = getHistoryList("Today|Yesterday"); View history = hlist.getChildAt(1); // Getting child at 1 because 0 might be the "Today" label mSolo.clickLongOnView(history); @@ -113,6 +107,13 @@ public class testShareLink extends BaseTest { mAsserter.ok(optionDisplayed(option, displayedOptions), "Share option for " + openedFrom + (openedFrom.equals("Awesomebar") ? "" : " item") + " found", option); } mActions.sendSpecialKey(Actions.SpecialKey.BACK); + /** + * Adding a wait for the page title to make sure the Awesomebar will be dismissed + * Because of Bug 712370 the Awesomescreen will be dismissed when the Share Menu is closed + * so there is no need for handeling this different depending on where the share menu was invoced from + * TODO: Look more into why the delay is needed here now and it was working before + */ + waitForText(urlTitle); } // Create a SEND intent and get the possible activities offered diff --git a/mobile/android/chrome/content/MemoryObserver.js b/mobile/android/chrome/content/MemoryObserver.js index 04c771cbef19..6315ee5901cb 100644 --- a/mobile/android/chrome/content/MemoryObserver.js +++ b/mobile/android/chrome/content/MemoryObserver.js @@ -50,6 +50,7 @@ var MemoryObserver = { browser.__SS_data = data; browser.__SS_extdata = extra; browser.__SS_restore = true; + browser.setAttribute("pending", "true"); }, gc: function() { diff --git a/mobile/android/chrome/content/SelectionHandler.js b/mobile/android/chrome/content/SelectionHandler.js index 778915a73848..7fa0d80717b0 100644 --- a/mobile/android/chrome/content/SelectionHandler.js +++ b/mobile/android/chrome/content/SelectionHandler.js @@ -332,7 +332,12 @@ var SelectionHandler = { // Get rect of editor let editorBounds = this._domWinUtils.sendQueryContentEvent(this._domWinUtils.QUERY_EDITOR_RECT, 0, 0, 0, 0); - let editorRect = new Rect(editorBounds.left, editorBounds.top, editorBounds.width, editorBounds.height); + // the return value from sendQueryContentEvent is in LayoutDevice pixels and we want CSS pixels, so + // divide by the pixel ratio + let editorRect = new Rect(editorBounds.left / window.devicePixelRatio, + editorBounds.top / window.devicePixelRatio, + editorBounds.width / window.devicePixelRatio, + editorBounds.height / window.devicePixelRatio); // Use intersection of the text rect and the editor rect let rect = new Rect(textBounds.left, textBounds.top, textBounds.width, textBounds.height); @@ -498,8 +503,10 @@ var SelectionHandler = { // The left and top properties returned are relative to the client area // of the window, so we don't need to account for a sub-frame offset. let cursor = this._domWinUtils.sendQueryContentEvent(this._domWinUtils.QUERY_CARET_RECT, this._targetElement.selectionEnd, 0, 0, 0); - let x = cursor.left; - let y = cursor.top + cursor.height; + // the return value from sendQueryContentEvent is in LayoutDevice pixels and we want CSS pixels, so + // divide by the pixel ratio + let x = cursor.left / window.devicePixelRatio; + let y = (cursor.top + cursor.height) / window.devicePixelRatio; positions = [{ handle: this.HANDLE_TYPE_MIDDLE, left: x + scrollX.value, top: y + scrollY.value, diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js index 7aab0170e026..67cdaa0d9133 100644 --- a/mobile/android/components/SessionStore.js +++ b/mobile/android/components/SessionStore.js @@ -418,6 +418,7 @@ SessionStore.prototype = { this._restoreHistory(data, aBrowser.sessionHistory); delete aBrowser.__SS_restore; + aBrowser.removeAttribute("pending"); } this.saveStateDelayed(); @@ -861,10 +862,12 @@ SessionStore.prototype = { if (window.BrowserApp.selectedTab == tab) { this._restoreHistory(tabData, tab.browser.sessionHistory); delete tab.browser.__SS_restore; + tab.browser.removeAttribute("pending"); } else { // Make sure the browser has its session data for the delay reload tab.browser.__SS_data = tabData; tab.browser.__SS_restore = true; + tab.browser.setAttribute("pending", "true"); } tab.browser.__SS_extdata = tabData.extData; diff --git a/mobile/android/config/mozconfigs/android/nightly b/mobile/android/config/mozconfigs/android/nightly index ef284434137d..3d01b3b8406e 100644 --- a/mobile/android/config/mozconfigs/android/nightly +++ b/mobile/android/config/mozconfigs/android/nightly @@ -19,6 +19,7 @@ ac_add_options --with-android-version=9 ac_add_options --with-system-zlib ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} ac_add_options --enable-profiling +ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling export JAVA_HOME=/tools/jdk6 export MOZILLA_OFFICIAL=1 diff --git a/mobile/android/config/mozconfigs/common b/mobile/android/config/mozconfigs/common index 821ad13afec2..2aa12deb037b 100644 --- a/mobile/android/config/mozconfigs/common +++ b/mobile/android/config/mozconfigs/common @@ -10,3 +10,5 @@ # much slower and we didn't want to slow down developers builds. # Has no effect when MOZ_ENABLE_SZIP is not set in mobile/android/confvars.sh. MOZ_SZIP_FLAGS="-D auto -f auto" + +ac_add_options --enable-elf-hack diff --git a/mobile/android/locales/jar.mn b/mobile/android/locales/jar.mn index 9ebbb7eb1446..ade1839d56ab 100644 --- a/mobile/android/locales/jar.mn +++ b/mobile/android/locales/jar.mn @@ -45,6 +45,17 @@ relativesrcdir toolkit/locales: locale/@AB_CD@/browser/overrides/passwordmgr.properties (%chrome/passwordmgr/passwordmgr.properties) locale/@AB_CD@/browser/overrides/search/search.properties (%chrome/search/search.properties) locale/@AB_CD@/browser/overrides/update/updates.properties (%chrome/mozapps/update/updates.properties) +# about:support + locale/@AB_CD@/browser/overrides/global/aboutSupport.dtd (%chrome/global/aboutSupport.dtd) + locale/@AB_CD@/browser/overrides/global/aboutSupport.properties (%chrome/global/aboutSupport.properties) +#about:crashes + locale/@AB_CD@/browser/overrides/crashreporter/crashes.dtd (%crashreporter/crashes.dtd) + locale/@AB_CD@/browser/overrides/crashreporter/crashes.properties (%crashreporter/crashes.properties) +#about:mozilla + locale/@AB_CD@/browser/overrides/global/mozilla.dtd (%chrome/global/mozilla.dtd) +#about:telemetry + locale/@AB_CD@/browser/overrides/global/aboutTelemetry.dtd (%chrome/global/aboutTelemetry.dtd) + locale/@AB_CD@/browser/overrides/global/aboutTelemetry.properties (%chrome/global/aboutTelemetry.properties) % override chrome://global/locale/about.dtd chrome://browser/locale/overrides/about.dtd % override chrome://global/locale/aboutAbout.dtd chrome://browser/locale/overrides/aboutAbout.dtd @@ -56,13 +67,25 @@ relativesrcdir toolkit/locales: % override chrome://passwordmgr/locale/passwordmgr.properties chrome://browser/locale/overrides/passwordmgr/passwordmgr.properties % override chrome://global/locale/search/search.properties chrome://browser/locale/overrides/search/search.properties % override chrome://mozapps/locale/update/updates.properties chrome://browser/locale/overrides/update/updates.properties +% override chrome://global/locale/aboutSupport.dtd chrome://browser/locale/overrides/global/aboutSupport.dtd +% override chrome://global/locale/aboutSupport.properties chrome://browser/locale/overrides/global/aboutSupport.properties +% override chrome://global/locale/crashes.dtd chrome://browser/locale/overrides/crashreporter/crashes.dtd +% override chrome://global/locale/crashes.properties chrome://browser/locale/overrides/crashreporter/crashes.properties +% override chrome://global/locale/mozilla.dtd chrome://browser/locale/overrides/global/mozilla.dtd +% override chrome://global/locale/aboutTelemetry.dtd chrome://browser/locale/overrides/global/aboutTelemetry.dtd +% override chrome://global/locale/aboutTelemetry.properties chrome://browser/locale/overrides/global/aboutTelemetry.properties # overrides for dom l10n, also for en-US relativesrcdir dom/locales: locale/@AB_CD@/browser/overrides/charsetTitles.properties (%chrome/charsetTitles.properties) locale/@AB_CD@/browser/overrides/global.dtd (%chrome/global.dtd) locale/@AB_CD@/browser/overrides/AccessFu.properties (%chrome/accessibility/AccessFu.properties) + locale/@AB_CD@/browser/overrides/dom/dom.properties (%chrome/dom/dom.properties) +#about:plugins + locale/@AB_CD@/browser/overrides/plugins.properties (%chrome/plugins.properties) % override chrome://global/locale/charsetTitles.properties chrome://browser/locale/overrides/charsetTitles.properties % override chrome://global/locale/global.dtd chrome://browser/locale/overrides/global.dtd % override chrome://global/locale/AccessFu.properties chrome://browser/locale/overrides/AccessFu.properties +% override chrome://global/locale/dom/dom.properties chrome://browser/locale/overrides/dom/dom.properties +% override chrome://global/locale/plugins.properties chrome://browser/locale/overrides/plugins.properties diff --git a/mobile/android/themes/core/browser.css b/mobile/android/themes/core/browser.css index 191cd60fdd67..34f147c620ce 100644 --- a/mobile/android/themes/core/browser.css +++ b/mobile/android/themes/core/browser.css @@ -2,33 +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/. */ -%filter substitution -%include defines.inc - -/* content scrollbars */ -.scroller { - opacity: 0; - background-color: rgba(0, 0, 0, 0.4) !important; - -moz-border-top-colors: none !important; - -moz-border-bottom-colors: none !important; - -moz-border-right-colors: none !important; - -moz-border-left-colors: none !important; - border-radius: @border_radius_tiny@; - border: @border_width_tiny@ solid rgba(255, 255, 255, 0.4) !important; -} - -.scroller[panning="true"] { - opacity: 1; -} - -.scroller[orient="vertical"] { - min-width: @scroller_thickness@; - width: @scroller_thickness@; - min-height: @scroller_minimum@; -} - -.scroller[orient="horizontal"] { - min-height: @scroller_thickness@; - height: @scroller_thickness@; - min-width: @scroller_minimum@; +/** + * Optimization for tabs that are restored lazily. We can save a good amount of + * memory that to-be-restored tabs would otherwise consume simply by setting + * their browsers to 'display: none' as that will prevent them from having to + * create a presentation and the like. + */ +browser[pending] { + display: none; } diff --git a/mobile/android/themes/core/content.css b/mobile/android/themes/core/content.css index eba20aed5b21..8644d6e602ca 100644 --- a/mobile/android/themes/core/content.css +++ b/mobile/android/themes/core/content.css @@ -248,7 +248,9 @@ select:not([size]):not([multiple])[disabled], select[size="0"][disabled], select[size="1"][disabled], button[disabled], -* > input:not([type="image"])[disabled] { +button[disabled]:active, +* > input:not([type="image"])[disabled], +* > input:not([type="image"])[disabled]:active { color: rgba(0,0,0,0.3); border-color: rgba(125,125,125,0.4); border-style: solid; @@ -263,9 +265,13 @@ select[size="1"][disabled] { } input[type="button"][disabled], +input[type="button"][disabled]:active, input[type="submit"][disabled], +input[type="submit"][disabled]:active, input[type="reset"][disabled], -button[disabled="true"] { +input[type="reset"][disabled]:active, +button[disabled], +button[disabled]:active { padding: 0 7px 0 7px; background: transparent linear-gradient(rgba(255,255,255,0.4) 0, rgba(235,235,235,0.4) 3px, rgba(185,185,185,0.4) 100%); } @@ -293,12 +299,12 @@ select[disabled] > button { *:-moz-any-link:active, *[role=button]:active, -button:active, -input:active, +button:not([disabled]):active, +input:not([disabled]):active, +select:not([disabled]):active, +textarea:not([disabled]):active, option:active, -select:active, label:active, -textarea:active, xul|menulist:active { background-color: @color_background_highlight_overlay@ !important; } diff --git a/mobile/android/themes/core/jar.mn b/mobile/android/themes/core/jar.mn index 215d5b9ed246..6f2044beb3e1 100644 --- a/mobile/android/themes/core/jar.mn +++ b/mobile/android/themes/core/jar.mn @@ -20,7 +20,7 @@ chrome.jar: * skin/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css) skin/aboutReader.css (aboutReader.css) skin/aboutSupport.css (aboutSupport.css) -* skin/browser.css (browser.css) + skin/browser.css (browser.css) * skin/content.css (content.css) skin/config.css (config.css) skin/touchcontrols.css (touchcontrols.css) diff --git a/mobile/locales/en-US/searchplugins/amazondotcom.xml b/mobile/locales/en-US/searchplugins/amazondotcom.xml index 6ee70830b26a..d52ff8633ff5 100644 --- a/mobile/locales/en-US/searchplugins/amazondotcom.xml +++ b/mobile/locales/en-US/searchplugins/amazondotcom.xml @@ -6,10 +6,10 @@ Amazon.com ISO-8859-1 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZJREFUeNrEV01IFGEYfndXNzq0QdalJOoUbQiBUuopD2k/GFSG/Vxyq0OHbCUjwn7AEooUzUNRkdkhS1o9JBVaUDctKqhoRQi0WjtlxG6XVtfpfb6Z2caZ2ZnZXZdeeJxvx+973+f9+775XJIkkUaWMcoYG5TxfMpvxlvGMGM8+RYEFOxn/JJyLzOMiwwv7LqUCNQwHjpxIxKJ0Gg4LABZUVhIfr+f1jLSlNuMwyCwEHoZS6xmvxoZoc6Oq+JpJoVMpOncWdpcWZkOiRIQ2MKDp1az+kIhOtV40pHG6zdvpEOixc1/VtqFvKX5gmOX0pkL2yDgsZpxt+sORaPROe8Q6ncf3tPAk8eG3Ks14lA8brsZYZ2yukBAwOfzCeMHA3WGNXrCVpLnJKeqRyhAfX5RfNmILQF4urG0VIzxBBkU5aQI9agIeU4JqNLZ0UH9ob6sDWZE4MDefSn7P1txO/FcbxypQG18nhinew/u5zYC3dyG+qLL1qjjCKDg9C21q2a3oe9zRsCsn2PR2JzfKEy9PB96Nj8E0IJm54IaGZwPZsWJOU4jY1kD2OlAQhsJjKu3bSe7yPUzifpgMPsuOBY8brtR1evmyFt0IL0IzH4fJtcCH7kK1hn2/hh71G1yKKEdz/DBBIOTkUkRemzVl1uvCGKzE4OMIaFbiv1LSX51L7mXl4kxvgeO8vMaJk0PHiHvjl4DCTWs2lMOX0L6cwD/Bxlp6hNNv2gUT9MjsLiB8koaMOxJRgCMgPijWsqvaCP3qqqUZ4JVzUASYyFyL/WTqyggPxWH4qGtBlJzagCGIYjEzJv2zHe38vOUt6mNPGv20OyPMMV7yuVwL5IjBlLmRej1UX7VLdmLt+2CMVKTiSDn0wO1NPPyBOtdLL+MyzWkTbGhC5AGsBdKkEtWAjglgjUwCq/FGjhV0ZosdOhXI5FyH0DoIIK9slB0CS8UCgr8AlpvpamwqHpttcO4WtSqA57ioKENE05IqIYSY46uD4Is0qmGG2s9RYeS7adI3Paz3K6lTMmzIdFmXp/d1Gb1YvLF7i4IzxMfu1ITYWOe1VWix7U5tlKpXkzwYycONqfVLcW+cU7lQ0jePf360DqRS4zT/+Ny+ofRxPBoL6fa6zmu5uvtbkwZyE/lev6a8VV9+VeAAQADg36zc4GRNAAAAABJRU5ErkJggg== - + -http://m.amazon.com/ +http://www.amazon.com/ diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index e945091a3134..6fb09f66a7be 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -26,7 +26,7 @@ #endif // For placement new used for arena allocations of zip file list -#include NEW_H +#include #define ZIP_ARENABLOCKSIZE (1*1024) #ifdef XP_UNIX diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index b624ede99b3e..5d1fb8b592d3 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -1854,11 +1854,11 @@ pref("dom.max_script_run_time", 10); // If true, ArchiveReader will be enabled pref("dom.archivereader.enabled", false); -// If true, Future will be enabled +// If true, Promise will be enabled #ifdef RELEASE_BUILD -pref("dom.future.enabled", false); +pref("dom.promise.enabled", false); #else -pref("dom.future.enabled", true); +pref("dom.promise.enabled", true); #endif // Hang monitor timeout after which we kill the browser, in seconds @@ -1936,6 +1936,14 @@ pref("svg.paint-order.enabled", false); pref("svg.paint-order.enabled", true); #endif +// Is support for the new marker features from SVG 2 enabled? Currently +// this just includes . +#ifdef RELEASE_BUILD +pref("svg.marker-improvements.enabled", false); +#else +pref("svg.marker-improvements.enabled", true); +#endif + // Is support for the new SVG text implementation enabled? pref("svg.text.css-frames.enabled", true); diff --git a/netwerk/Makefile.in b/netwerk/Makefile.in index cb80f2af6a33..d2044d8ab77b 100644 --- a/netwerk/Makefile.in +++ b/netwerk/Makefile.in @@ -11,4 +11,3 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/base/Makefile.in b/netwerk/base/Makefile.in index c09e7a7f3991..0c112ea4ab93 100644 --- a/netwerk/base/Makefile.in +++ b/netwerk/base/Makefile.in @@ -11,4 +11,3 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/base/public/Makefile.in b/netwerk/base/public/Makefile.in index 08045875b61a..45531d6beca7 100644 --- a/netwerk/base/public/Makefile.in +++ b/netwerk/base/public/Makefile.in @@ -14,4 +14,4 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET +DEFINES += -DIMPL_LIBXUL diff --git a/netwerk/base/public/nsChannelProperties.h b/netwerk/base/public/nsChannelProperties.h index cc4f8fcde529..0323a6f39d13 100644 --- a/netwerk/base/public/nsChannelProperties.h +++ b/netwerk/base/public/nsChannelProperties.h @@ -6,7 +6,7 @@ #define nsChannelProperties_h__ #include "nsStringGlue.h" -#ifdef IMPL_NS_NET +#ifdef IMPL_LIBXUL #include "nsNetStrings.h" #endif @@ -25,7 +25,7 @@ */ #define NS_CHANNEL_PROP_CHANNEL_POLICY_STR "channel-policy" -#ifdef IMPL_NS_NET +#ifdef IMPL_LIBXUL #define NS_CHANNEL_PROP_CHANNEL_POLICY gNetStrings->kChannelPolicy #else #define NS_CHANNEL_PROP_CHANNEL_POLICY \ diff --git a/netwerk/base/src/Makefile.in b/netwerk/base/src/Makefile.in index ca91945a9c4a..d6165fe6f0ef 100644 --- a/netwerk/base/src/Makefile.in +++ b/netwerk/base/src/Makefile.in @@ -28,10 +28,6 @@ ifdef MOZ_ENABLE_QTNETWORK endif endif -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk @@ -41,8 +37,6 @@ ifeq ($(OS_TARGET),Android) nsURLParsers.$(OBJ_SUFFIX): MOZ_OPTIMIZE_FLAGS= endif -DEFINES += -DIMPL_NS_NET - ifdef MOZ_ENABLE_LIBCONIC OS_INCLUDES += $(GLIB_CFLAGS) $(LIBCONIC_CFLAGS) endif diff --git a/netwerk/base/src/nsUDPServerSocket.cpp b/netwerk/base/src/nsUDPServerSocket.cpp index d156bb110323..d0fa2016ee92 100644 --- a/netwerk/base/src/nsUDPServerSocket.cpp +++ b/netwerk/base/src/nsUDPServerSocket.cpp @@ -513,7 +513,7 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener { public: ServerSocketListenerProxy(nsIUDPServerSocketListener* aListener) - : mListener(aListener) + : mListener(new nsMainThreadPtrHolder(aListener)) , mTargetThread(do_GetCurrentThread()) { } @@ -523,7 +523,7 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener class OnPacketReceivedRunnable : public nsRunnable { public: - OnPacketReceivedRunnable(nsIUDPServerSocketListener* aListener, + OnPacketReceivedRunnable(nsMainThreadPtrHolder* aListener, nsIUDPServerSocket* aServ, nsIUDPMessage* aMessage) : mListener(aListener) @@ -534,7 +534,7 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener NS_DECL_NSIRUNNABLE private: - nsCOMPtr mListener; + nsMainThreadPtrHandle mListener; nsCOMPtr mServ; nsCOMPtr mMessage; }; @@ -542,7 +542,7 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener class OnStopListeningRunnable : public nsRunnable { public: - OnStopListeningRunnable(nsIUDPServerSocketListener* aListener, + OnStopListeningRunnable(nsMainThreadPtrHolder* aListener, nsIUDPServerSocket* aServ, nsresult aStatus) : mListener(aListener) @@ -553,13 +553,13 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener NS_DECL_NSIRUNNABLE private: - nsCOMPtr mListener; + nsMainThreadPtrHandle mListener; nsCOMPtr mServ; nsresult mStatus; }; private: - nsCOMPtr mListener; + nsMainThreadPtrHandle mListener; nsCOMPtr mTargetThread; }; diff --git a/netwerk/build/Makefile.in b/netwerk/build/Makefile.in index 6b807da75806..010e8d22b5e2 100644 --- a/netwerk/build/Makefile.in +++ b/netwerk/build/Makefile.in @@ -126,4 +126,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cache/Makefile.in b/netwerk/cache/Makefile.in index 0ad1f4fb7d07..504f608b6835 100644 --- a/netwerk/cache/Makefile.in +++ b/netwerk/cache/Makefile.in @@ -14,12 +14,9 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../base/src \ $(NULL) include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cookie/Makefile.in b/netwerk/cookie/Makefile.in index 024ad331498c..e9eb2725b114 100644 --- a/netwerk/cookie/Makefile.in +++ b/netwerk/cookie/Makefile.in @@ -18,7 +18,6 @@ ifdef NECKO_COOKIES LIBRARY_NAME = neckocookie_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 LOCAL_INCLUDES = \ -I$(topsrcdir)/intl/uconv/src \ @@ -31,4 +30,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/dash/Makefile.in b/netwerk/dash/Makefile.in index 2387584ea8a1..d019128ad565 100644 --- a/netwerk/dash/Makefile.in +++ b/netwerk/dash/Makefile.in @@ -17,4 +17,3 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/dash/mpd/Makefile.in b/netwerk/dash/mpd/Makefile.in index 9c4b751867d8..43999506e546 100644 --- a/netwerk/dash/mpd/Makefile.in +++ b/netwerk/dash/mpd/Makefile.in @@ -16,7 +16,6 @@ VPATH := @srcdir@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY := 1 -FORCE_STATIC_LIB := 1 LOCAL_INCLUDES := \ -I$(topsrcdir)/content/base/src \ @@ -26,4 +25,3 @@ LOCAL_INCLUDES := \ include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/dns/Makefile.in b/netwerk/dns/Makefile.in index 76e7805b5a56..1f86632f70b8 100644 --- a/netwerk/dns/Makefile.in +++ b/netwerk/dns/Makefile.in @@ -20,10 +20,6 @@ DISABLED_CSRCS = \ punycode.c \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - # need to include etld_data.inc LOCAL_INCLUDES = \ -I$(srcdir)/../base/src \ @@ -32,7 +28,7 @@ LOCAL_INCLUDES = \ include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET \ +DEFINES += \ -DHB_DONT_DEFINE_STDINT \ $(NULL) diff --git a/netwerk/ipc/Makefile.in b/netwerk/ipc/Makefile.in index b6b60ba20213..80e5560a15f7 100644 --- a/netwerk/ipc/Makefile.in +++ b/netwerk/ipc/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = neckoipc_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 LOCAL_INCLUDES += \ -I$(srcdir)/../protocol/http \ diff --git a/netwerk/mime/Makefile.in b/netwerk/mime/Makefile.in index b838f3d42981..8f31acf4d80b 100644 --- a/netwerk/mime/Makefile.in +++ b/netwerk/mime/Makefile.in @@ -14,9 +14,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/protocol/Makefile.in b/netwerk/protocol/Makefile.in index e22b50d84f05..f6bf6df58a29 100644 --- a/netwerk/protocol/Makefile.in +++ b/netwerk/protocol/Makefile.in @@ -11,4 +11,3 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/about/Makefile.in b/netwerk/protocol/about/Makefile.in index ca0b6151aff8..f7df7944330e 100644 --- a/netwerk/protocol/about/Makefile.in +++ b/netwerk/protocol/about/Makefile.in @@ -14,8 +14,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkabout_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../../base/src \ $(NULL) @@ -24,4 +22,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/data/Makefile.in b/netwerk/protocol/data/Makefile.in index 9f9e56c7a99f..82157dddcb8a 100644 --- a/netwerk/protocol/data/Makefile.in +++ b/netwerk/protocol/data/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../../base/src \ $(NULL) diff --git a/netwerk/protocol/device/Makefile.in b/netwerk/protocol/device/Makefile.in index cc64f19d36e5..3efc73658824 100644 --- a/netwerk/protocol/device/Makefile.in +++ b/netwerk/protocol/device/Makefile.in @@ -11,7 +11,6 @@ FAIL_ON_WARNINGS = 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkdevice_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES = -I$(srcdir)/../../base/src/ \ @@ -21,4 +20,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/file/Makefile.in b/netwerk/protocol/file/Makefile.in index 954284c0bd80..1ff638f3323a 100644 --- a/netwerk/protocol/file/Makefile.in +++ b/netwerk/protocol/file/Makefile.in @@ -14,8 +14,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../../base/src \ -I$(topsrcdir)/xpcom/ds \ @@ -23,5 +21,3 @@ LOCAL_INCLUDES = \ include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/protocol/ftp/Makefile.in b/netwerk/protocol/ftp/Makefile.in index dedc936c6537..6b385e3ed5ee 100644 --- a/netwerk/protocol/ftp/Makefile.in +++ b/netwerk/protocol/ftp/Makefile.in @@ -15,8 +15,6 @@ LIBRARY_NAME = nkftp_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../../base/src \ -I$(topsrcdir)/xpcom/ds \ @@ -34,4 +32,3 @@ endif endif endif # WINNT -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/http/Makefile.in b/netwerk/protocol/http/Makefile.in index 67949f995a17..5982fa88ac2d 100644 --- a/netwerk/protocol/http/Makefile.in +++ b/netwerk/protocol/http/Makefile.in @@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkhttp_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 LOCAL_INCLUDES = \ @@ -27,5 +26,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/protocol/res/Makefile.in b/netwerk/protocol/res/Makefile.in index b316ed3e53a9..284c4938e153 100644 --- a/netwerk/protocol/res/Makefile.in +++ b/netwerk/protocol/res/Makefile.in @@ -15,8 +15,6 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(topsrcdir)/netwerk/base/src \ $(NULL) @@ -25,5 +23,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/protocol/viewsource/Makefile.in b/netwerk/protocol/viewsource/Makefile.in index bc10c1702ce2..7057c5829231 100644 --- a/netwerk/protocol/viewsource/Makefile.in +++ b/netwerk/protocol/viewsource/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(srcdir)/../../base/src \ $(NULL) diff --git a/netwerk/protocol/websocket/Makefile.in b/netwerk/protocol/websocket/Makefile.in index 45d0040c4900..909bef617960 100644 --- a/netwerk/protocol/websocket/Makefile.in +++ b/netwerk/protocol/websocket/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkwebsocket_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS = 1 LOCAL_INCLUDES = \ @@ -26,4 +25,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/wyciwyg/Makefile.in b/netwerk/protocol/wyciwyg/Makefile.in index ac38eb4dacf7..0cd0eec91cc7 100644 --- a/netwerk/protocol/wyciwyg/Makefile.in +++ b/netwerk/protocol/wyciwyg/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkwyciwyg_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS = 1 LOCAL_INCLUDES = \ @@ -22,5 +21,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/sctp/datachannel/Makefile.in b/netwerk/sctp/datachannel/Makefile.in index b74e7396a278..72903c4f9381 100644 --- a/netwerk/sctp/datachannel/Makefile.in +++ b/netwerk/sctp/datachannel/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkdatachan_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO FAIL_ON_WARNINGS = 1 @@ -44,4 +43,3 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/sctp/src/Makefile.in b/netwerk/sctp/src/Makefile.in index 42b0456eace9..183db07174a1 100644 --- a/netwerk/sctp/src/Makefile.in +++ b/netwerk/sctp/src/Makefile.in @@ -16,7 +16,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nksctp_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO DISABLED_CSRCS = \ @@ -132,4 +131,3 @@ ifdef GNU_CC CFLAGS += -std=gnu99 endif -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/socket/Makefile.in b/netwerk/socket/Makefile.in index a29d4e20688f..361ed47544b4 100644 --- a/netwerk/socket/Makefile.in +++ b/netwerk/socket/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/srtp/src/Makefile.in b/netwerk/srtp/src/Makefile.in index b72b774e046f..b534ee605761 100644 --- a/netwerk/srtp/src/Makefile.in +++ b/netwerk/srtp/src/Makefile.in @@ -22,7 +22,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nksrtp_s LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 DISABLED_CSRCS := \ ekt.c \ @@ -108,4 +107,3 @@ ifdef GNU_CC CFLAGS += -std=gnu99 endif -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/streamconv/Makefile.in b/netwerk/streamconv/Makefile.in index c09e7a7f3991..0c112ea4ab93 100644 --- a/netwerk/streamconv/Makefile.in +++ b/netwerk/streamconv/Makefile.in @@ -11,4 +11,3 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/streamconv/converters/Makefile.in b/netwerk/streamconv/converters/Makefile.in index 438830826db6..486169e9d43f 100644 --- a/netwerk/streamconv/converters/Makefile.in +++ b/netwerk/streamconv/converters/Makefile.in @@ -14,14 +14,9 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - LOCAL_INCLUDES = \ -I$(topsrcdir)/netwerk/base/src \ $(NULL) include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/streamconv/public/Makefile.in b/netwerk/streamconv/public/Makefile.in index fc8bb176bcb5..711d3c091158 100644 --- a/netwerk/streamconv/public/Makefile.in +++ b/netwerk/streamconv/public/Makefile.in @@ -14,5 +14,3 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - diff --git a/netwerk/streamconv/src/Makefile.in b/netwerk/streamconv/src/Makefile.in index 7db8b1d95f50..fd8908725746 100644 --- a/netwerk/streamconv/src/Makefile.in +++ b/netwerk/streamconv/src/Makefile.in @@ -20,10 +20,5 @@ FAIL_ON_WARNINGS := 1 endif endif -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/system/android/Makefile.in b/netwerk/system/android/Makefile.in index 23b2f87b5f2e..38abf5c61d9a 100644 --- a/netwerk/system/android/Makefile.in +++ b/netwerk/system/android/Makefile.in @@ -12,11 +12,7 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - LOCAL_INCLUDES += -I$(srcdir)/../../base/src diff --git a/netwerk/system/mac/Makefile.in b/netwerk/system/mac/Makefile.in index 5cd5eabb4a58..211db0b53f47 100644 --- a/netwerk/system/mac/Makefile.in +++ b/netwerk/system/mac/Makefile.in @@ -13,8 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - - include $(topsrcdir)/config/rules.mk diff --git a/netwerk/system/maemo/Makefile.in b/netwerk/system/maemo/Makefile.in index befd8d4fb22b..18758f447159 100644 --- a/netwerk/system/maemo/Makefile.in +++ b/netwerk/system/maemo/Makefile.in @@ -12,12 +12,8 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - OS_INCLUDES += $(GLIB_CFLAGS) $(LIBCONIC_CFLAGS) LOCAL_INCLUDES += -I$(srcdir)/../../base/src diff --git a/netwerk/system/qt/Makefile.in b/netwerk/system/qt/Makefile.in index 0cb5970932e8..9e69c12f489e 100644 --- a/netwerk/system/qt/Makefile.in +++ b/netwerk/system/qt/Makefile.in @@ -13,11 +13,7 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET - OS_INCLUDES += $(MOZ_QT_CFLAGS) LOCAL_INCLUDES += -I$(srcdir)/../../base/src diff --git a/netwerk/system/win32/Makefile.in b/netwerk/system/win32/Makefile.in index aba837cc84c6..211db0b53f47 100644 --- a/netwerk/system/win32/Makefile.in +++ b/netwerk/system/win32/Makefile.in @@ -13,8 +13,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/wifi/Makefile.in b/netwerk/wifi/Makefile.in index 39d736437f89..26dbd79fab29 100644 --- a/netwerk/wifi/Makefile.in +++ b/netwerk/wifi/Makefile.in @@ -11,8 +11,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - ifneq ($(OS_ARCH),Darwin) # osx_corewlan.mm has warnings I don't understand. FAIL_ON_WARNINGS := 1 @@ -28,4 +26,3 @@ endif include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/other-licenses/snappy/Makefile.in b/other-licenses/snappy/Makefile.in index 50e93756e947..a57131a9ca06 100644 --- a/other-licenses/snappy/Makefile.in +++ b/other-licenses/snappy/Makefile.in @@ -13,7 +13,6 @@ VPATH = \ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/parser/html/Makefile.in b/parser/html/Makefile.in index 23273b0d4885..d44d6e0e620b 100644 --- a/parser/html/Makefile.in +++ b/parser/html/Makefile.in @@ -12,8 +12,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk INCLUDES += \ diff --git a/parser/xml/src/Makefile.in b/parser/xml/src/Makefile.in index c95f8f2a4315..0c4bae861640 100644 --- a/parser/xml/src/Makefile.in +++ b/parser/xml/src/Makefile.in @@ -14,7 +14,4 @@ MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 LIBXUL_LIBRARY = 1 - -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/python/mozbuild/mozbuild/action/__init__.py b/python/mozbuild/mozbuild/action/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/config/purge_directories.py b/python/mozbuild/mozbuild/action/purge_manifests.py similarity index 100% rename from config/purge_directories.py rename to python/mozbuild/mozbuild/action/purge_manifests.py diff --git a/build/xpccheck.py b/python/mozbuild/mozbuild/action/xpccheck.py similarity index 100% rename from build/xpccheck.py rename to python/mozbuild/mozbuild/action/xpccheck.py diff --git a/python/mozbuild/mozbuild/controller/clobber.py b/python/mozbuild/mozbuild/controller/clobber.py index 07bf1cb06ccc..44119a3ff69e 100644 --- a/python/mozbuild/mozbuild/controller/clobber.py +++ b/python/mozbuild/mozbuild/controller/clobber.py @@ -31,8 +31,8 @@ $ mach clobber -If you know this clobber doesn't apply to you or you're feeling lucky \ -- well do ya? - you can ignore this clobber requirement by running: +If you know this clobber doesn't apply to you or you're feeling lucky -- \ +Well, are ya? -- you can ignore this clobber requirement by running: $ touch {clobber_file} '''.splitlines()]) diff --git a/rdf/base/src/Makefile.in b/rdf/base/src/Makefile.in index 541ee89b71c8..99d07d15669e 100644 --- a/rdf/base/src/Makefile.in +++ b/rdf/base/src/Makefile.in @@ -12,8 +12,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/rdf/datasource/src/Makefile.in b/rdf/datasource/src/Makefile.in index c7cfa70aedee..ed191e44d09c 100644 --- a/rdf/datasource/src/Makefile.in +++ b/rdf/datasource/src/Makefile.in @@ -12,9 +12,6 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk # XXX This is a dependency on rdfutil.h: it'll go away once that becomes diff --git a/storage/src/Makefile.in b/storage/src/Makefile.in index c9dbd03f4ca2..74b6a3a8f479 100644 --- a/storage/src/Makefile.in +++ b/storage/src/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 # TODO: we do this in crashreporter and xpcom/base too, should be centralized diff --git a/testing/runcppunittests.py b/testing/runcppunittests.py index a24e86c301fd..f44aff32e741 100644 --- a/testing/runcppunittests.py +++ b/testing/runcppunittests.py @@ -139,7 +139,13 @@ def main(): if not options.xre_path: print >>sys.stderr, """Error: --xre-path is required""" sys.exit(1) - progs = [os.path.abspath(p) for p in args] + progs = [] + for p in args: + if os.path.isdir(p): + #filter out .py files packaged with the unit tests + progs.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p) if not x.endswith('.py')]) + else: + progs.append(os.path.abspath(p)) options.xre_path = os.path.abspath(options.xre_path) tester = CPPUnitTests() try: diff --git a/toolkit/components/alerts/Makefile.in b/toolkit/components/alerts/Makefile.in index 578eb76956b9..4e19d89a59d9 100644 --- a/toolkit/components/alerts/Makefile.in +++ b/toolkit/components/alerts/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = alerts_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/build/ diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in index 7a6c26d92d28..c04ff6967f91 100644 --- a/toolkit/components/downloads/Makefile.in +++ b/toolkit/components/downloads/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = download_s -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/toolkit/components/feeds/Makefile.in b/toolkit/components/feeds/Makefile.in index 7be0703ede72..84fd69aa96c7 100644 --- a/toolkit/components/feeds/Makefile.in +++ b/toolkit/components/feeds/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MOZILLA_INTERNAL_API = 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/toolkit/components/find/Makefile.in b/toolkit/components/find/Makefile.in index ea89e3cf6dd6..35fbe699bd1a 100644 --- a/toolkit/components/find/Makefile.in +++ b/toolkit/components/find/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/toolkit/components/intl/Makefile.in b/toolkit/components/intl/Makefile.in index d17140f1017e..dbc3e1df5120 100644 --- a/toolkit/components/intl/Makefile.in +++ b/toolkit/components/intl/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/toolkit/components/jsdownloads/test/unit/head.js b/toolkit/components/jsdownloads/test/unit/head.js index 1cbef8e8acf2..295113f5d262 100644 --- a/toolkit/components/jsdownloads/test/unit/head.js +++ b/toolkit/components/jsdownloads/test/unit/head.js @@ -51,28 +51,47 @@ const BinaryOutputStream = Components.Constructor( "nsIBinaryOutputStream", "setOutputStream") -const HTTP_SERVER_PORT = 4444; -const HTTP_BASE = "http://localhost:" + HTTP_SERVER_PORT; +Object.defineProperty(this, "HTTP_BASE", {get: function() { + return "http://localhost:" + gHttpServer.identity.primaryPort; +}}); -const FAKE_SERVER_PORT = 4445; -const FAKE_BASE = "http://localhost:" + FAKE_SERVER_PORT; +Object.defineProperty(this, "FAKE_BASE", {get: function() { + return "http://localhost:" + gFakeServerPort; +}}); -const TEST_REFERRER_URI = NetUtil.newURI(HTTP_BASE + "/referrer.html"); -const TEST_SOURCE_URI = NetUtil.newURI(HTTP_BASE + "/source.txt"); -const TEST_EMPTY_URI = NetUtil.newURI(HTTP_BASE + "/empty.txt"); -const TEST_FAKE_SOURCE_URI = NetUtil.newURI(FAKE_BASE + "/source.txt"); +Object.defineProperty(this, "TEST_REFERRER_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + "/referrer.html"); +}}); + +Object.defineProperty(this, "TEST_SOURCE_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + "/source.txt"); +}}); + +Object.defineProperty(this, "TEST_EMPTY_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + "/empty.txt"); +}}); + +Object.defineProperty(this, "TEST_FAKE_SOURCE_URI", {get: function() { + return NetUtil.newURI(FAKE_BASE + "/source.txt"); +}}); const TEST_EMPTY_NOPROGRESS_PATH = "/empty-noprogress.txt"; -const TEST_EMPTY_NOPROGRESS_URI = NetUtil.newURI(HTTP_BASE + - TEST_EMPTY_NOPROGRESS_PATH); + +Object.defineProperty(this, "TEST_EMPTY_NOPROGRESS_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + TEST_EMPTY_NOPROGRESS_PATH); +}}); const TEST_INTERRUPTIBLE_PATH = "/interruptible.txt"; -const TEST_INTERRUPTIBLE_URI = NetUtil.newURI(HTTP_BASE + - TEST_INTERRUPTIBLE_PATH); + +Object.defineProperty(this, "TEST_INTERRUPTIBLE_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + TEST_INTERRUPTIBLE_PATH); +}}); const TEST_INTERRUPTIBLE_GZIP_PATH = "/interruptible_gzip.txt"; -const TEST_INTERRUPTIBLE_GZIP_URI = NetUtil.newURI(HTTP_BASE + - TEST_INTERRUPTIBLE_GZIP_PATH); + +Object.defineProperty(this, "TEST_INTERRUPTIBLE_GZIP_URI", {get: function() { + return NetUtil.newURI(HTTP_BASE + TEST_INTERRUPTIBLE_GZIP_PATH); +}}); const TEST_TARGET_FILE_NAME = "test-download.txt"; const TEST_STORE_FILE_NAME = "test-downloads.json"; @@ -284,7 +303,8 @@ function promiseAddDownloadToHistory(aSourceURI) { */ function startFakeServer() { - let serverSocket = new ServerSocket(FAKE_SERVER_PORT, true, -1); + let serverSocket = new ServerSocket(-1, true, -1); + gFakeServerPort = serverSocket.port; serverSocket.asyncListen({ onSocketAccepted: function (aServ, aTransport) { aTransport.close(Cr.NS_BINDING_ABORTED); @@ -410,13 +430,14 @@ function isValidDate(aDate) { //// Initialization functions common to all tests let gHttpServer; +let gFakeServerPort; add_task(function test_common_initialize() { // Start the HTTP server. gHttpServer = new HttpServer(); gHttpServer.registerDirectory("/", do_get_file("../data")); - gHttpServer.start(HTTP_SERVER_PORT); + gHttpServer.start(-1); registerInterruptibleHandler(TEST_INTERRUPTIBLE_PATH, function firstPart(aRequest, aResponse) { diff --git a/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest b/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest index fdf2904de7e6..bcb92086399d 100644 --- a/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest +++ b/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest @@ -16,10 +16,10 @@ - - - - + + + + diff --git a/toolkit/components/mediasniffer/test/unit/test_mediasniffer.js b/toolkit/components/mediasniffer/test/unit/test_mediasniffer.js index 0c360135a406..1810c8e1f336 100644 --- a/toolkit/components/mediasniffer/test/unit/test_mediasniffer.js +++ b/toolkit/components/mediasniffer/test/unit/test_mediasniffer.js @@ -67,7 +67,8 @@ function setupChannel(url, flags) { var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); - var chan = ios.newChannel("http://localhost:4444" + url, "", null); + var chan = ios.newChannel("http://localhost:" + + httpserver.identity.primaryPort + url, "", null); chan.loadFlags |= flags; var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel); return httpChan; @@ -87,7 +88,7 @@ function runNext() { } function run_test() { - httpserver.start(4444); + httpserver.start(-1); do_test_pending(); try { runNext(); diff --git a/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js b/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js index bdb934e7c3a2..5766ed464aa4 100644 --- a/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js +++ b/toolkit/components/mediasniffer/test/unit/test_mediasniffer_ext.js @@ -66,7 +66,8 @@ var listener = { function setupChannel(url) { var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); - var chan = ios.newChannel("http://localhost:4444" + url, "", null); + var chan = ios.newChannel("http://localhost:" + + httpserver.identity.primaryPort + url, "", null); var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel); return httpChan; } @@ -106,7 +107,7 @@ function handler(metadata, response) { function run_test() { // We use a custom handler so we can change the header to force sniffing. httpserver.registerPathHandler("/", handler); - httpserver.start(4444); + httpserver.start(-1); do_test_pending(); try { runNext(); diff --git a/toolkit/components/osfile/Makefile.in b/toolkit/components/osfile/Makefile.in index d6abd86de524..651502dd640a 100644 --- a/toolkit/components/osfile/Makefile.in +++ b/toolkit/components/osfile/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 EXTRA_PP_JS_MODULES = \ osfile.jsm \ diff --git a/toolkit/components/parentalcontrols/Makefile.in b/toolkit/components/parentalcontrols/Makefile.in index daabe6e9df0a..54eb37cda169 100644 --- a/toolkit/components/parentalcontrols/Makefile.in +++ b/toolkit/components/parentalcontrols/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk ifndef MOZ_DISABLE_PARENTAL_CONTROLS ifeq (WINNT,$(OS_ARCH)) -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 endif endif diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index c0a4302e5e70..bacb1553838e 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -2773,6 +2773,8 @@ NS_IMETHODIMP nsNavHistory::SetCharsetForURI(nsIURI* aURI, const nsAString& aCharset) { + PLACES_WARN_DEPRECATED(); + NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); NS_ENSURE_ARG(aURI); @@ -2809,6 +2811,8 @@ NS_IMETHODIMP nsNavHistory::GetCharsetForURI(nsIURI* aURI, nsAString& aCharset) { + 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/startup/Makefile.in b/toolkit/components/startup/Makefile.in index b5200d4e3a65..97e8f4373662 100644 --- a/toolkit/components/startup/Makefile.in +++ b/toolkit/components/startup/Makefile.in @@ -10,7 +10,6 @@ relativesrcdir = @relativesrcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) diff --git a/toolkit/components/statusfilter/Makefile.in b/toolkit/components/statusfilter/Makefile.in index e4c7485a6a5d..18047041218f 100644 --- a/toolkit/components/statusfilter/Makefile.in +++ b/toolkit/components/statusfilter/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 86b3090ba613..d3518f3a663d 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -2236,6 +2236,36 @@ "extended_statistics_ok": true, "description": "PLACES: Time to calculate frecency of a page (ms)" }, + "UPDATER_BACKGROUND_CHECK_CODE_EXTERNAL": { + "kind": "enumerated", + "n_values": 50, + "description": "Updater: externally initiated (typically by the application) background update check result code (see PING_BGUC_* constants defined in /toolkit/mozapps/update/nsUpdateService.js)" + }, + "UPDATER_BACKGROUND_CHECK_CODE_NOTIFY": { + "kind": "enumerated", + "n_values": 50, + "description": "Updater: timer initiated background update check result code (see PING_BGUC_* constants defined in /toolkit/mozapps/update/nsUpdateService.js)" + }, + "UPDATER_INVALID_LASTUPDATETIME_EXTERNAL": { + "kind": "boolean", + "description": "Updater: Whether the last update time is invalid when a background update check was externally requested (typically by the application)" + }, + "UPDATER_INVALID_LASTUPDATETIME_NOTIFY": { + "kind": "boolean", + "description": "Updater: Whether the last update time is invalid when a background update check was timer initiated" + }, + "UPDATER_LAST_NOTIFY_INTERVAL_DAYS_EXTERNAL": { + "kind": "exponential", + "n_buckets": 10, + "high": "60", + "description": "Updater: The interval in days between the previous and the current background update check when the check was externally requested (typically by the application)" + }, + "UPDATER_LAST_NOTIFY_INTERVAL_DAYS_NOTIFY": { + "kind": "exponential", + "n_buckets": 10, + "high": "60", + "description": "Updater: The interval in days between the previous and the current background update check when the check was timer initiated" + }, "UPDATER_STATUS_CODES": { "kind": "enumerated", "n_values": 50, @@ -2257,6 +2287,11 @@ "kind": "boolean", "description": "Updater: Whether or not the MozillaMaintenance service is enabled" }, + "UPDATER_SERVICE_ERROR_CODE": { + "kind": "enumerated", + "n_values": 100, + "description": "Updater: 0=success else SERVICE_* error code defined in /toolkit/mozapps/update/common/errors.h" + }, "UPDATER_SERVICE_ERRORS": { "kind": "enumerated", "n_values": 30, @@ -2278,6 +2313,11 @@ "kind": "boolean", "description": "Updater: Whether or not the updater has permissions" }, + "UPDATER_WIZ_LAST_PAGE_CODE": { + "kind": "enumerated", + "n_values": 25, + "description": "Updater: The update wizard page displayed when the UI was closed (mapped in toolkit/mozapps/update/content/updates.js)" + }, "THUNDERBIRD_GLODA_SIZE_MB": { "kind": "linear", "high": "1000", diff --git a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm index 030eef0dd281..fcfc3973925d 100644 --- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm +++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm @@ -34,8 +34,8 @@ const BackgroundPageThumbs = { * onDone(url), * where `url` is the captured URL. * @opt timeout The capture will time out after this many milliseconds have - * elapsed after calling this method. Defaults to 30000 (30 - * seconds). + * elapsed after the capture has progressed to the head of + * the queue and started. Defaults to 30000 (30 seconds). */ capture: function (url, options={}) { if (isPrivateBrowsingActive()) { @@ -186,16 +186,14 @@ const BackgroundPageThumbs = { }, /** - * Called when a capture completes or times out. + * Called when the current capture completes or times out. */ _onCaptureOrTimeout: function (capture) { - // Since timeouts are configurable per capture, and a capture's timeout - // timer starts when it's created, it's possible for any capture to time - // out regardless of its position in the queue. - let idx = this._captureQueue.indexOf(capture); - if (idx < 0) - throw new Error("The capture should be in the queue."); - this._captureQueue.splice(idx, 1); + // Since timeouts start as an item is being processed, only the first + // item in the queue can be passed to this method. + if (capture !== this._captureQueue[0]) + throw new Error("The capture should be at the head of the queue."); + this._captureQueue.shift(); this._capturesByURL.delete(capture.url); // Start the destroy-browser timer *before* processing the capture queue. @@ -227,13 +225,6 @@ function Capture(url, captureCallback, options) { this.doneCallbacks = []; if (options.onDone) this.doneCallbacks.push(options.onDone); - - // The timeout starts when the consumer requests the capture, not when the - // capture is dequeued and started. - let timeout = typeof(options.timeout) == "number" ? options.timeout : - DEFAULT_CAPTURE_TIMEOUT; - this._timeoutTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); - this._timeoutTimer.initWithCallback(this, timeout, Ci.nsITimer.TYPE_ONE_SHOT); } Capture.prototype = { @@ -248,6 +239,11 @@ Capture.prototype = { * @param messageManager The nsIMessageSender of the thumbnail browser. */ start: function (messageManager) { + let timeout = typeof(this.options.timeout) == "number" ? this.options.timeout : + DEFAULT_CAPTURE_TIMEOUT; + this._timeoutTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + this._timeoutTimer.initWithCallback(this, timeout, Ci.nsITimer.TYPE_ONE_SHOT); + this._msgMan = messageManager; this._msgMan.sendAsyncMessage("BackgroundPageThumbs:capture", { id: this.id, url: this.url }); @@ -258,15 +254,15 @@ Capture.prototype = { * The only intended external use of this method is by the service when it's * uninitializing and doing things like destroying the thumbnail browser. In * that case the consumer's completion callback will never be called. - * - * This method is not idempotent. It's an error to call it more than once on - * the same capture. */ destroy: function () { - this._timeoutTimer.cancel(); - delete this._timeoutTimer; + // This method may be called for captures that haven't started yet, so + // guard against not yet having _timeoutTimer, _msgMan etc properties... + if (this._timeoutTimer) { + this._timeoutTimer.cancel(); + delete this._timeoutTimer; + } if (this._msgMan) { - // The capture may have never started, so _msgMan may be undefined. this._msgMan.removeMessageListener("BackgroundPageThumbs:didCapture", this); delete this._msgMan; diff --git a/toolkit/components/thumbnails/content/backgroundPageThumbsContent.js b/toolkit/components/thumbnails/content/backgroundPageThumbsContent.js index 5c50e980fe27..7ef92e500c7a 100644 --- a/toolkit/components/thumbnails/content/backgroundPageThumbsContent.js +++ b/toolkit/components/thumbnails/content/backgroundPageThumbsContent.js @@ -18,6 +18,12 @@ const backgroundPageThumbsContent = { getInterface(Ci.nsIDOMWindowUtils); dwu.preventFurtherDialogs(); + // We want a low network priority for this service - lower than b/g tabs + // etc - so set it to the lowest priority available. + this._webNav.QueryInterface(Ci.nsIDocumentLoader). + loadGroup.QueryInterface(Ci.nsISupportsPriority). + priority = Ci.nsISupportsPriority.PRIORITY_LOWEST; + docShell.allowMedia = false; docShell.allowPlugins = false; diff --git a/toolkit/components/thumbnails/test/browser_thumbnails_background.js b/toolkit/components/thumbnails/test/browser_thumbnails_background.js index 99e04c0f95f2..8657033f012e 100644 --- a/toolkit/components/thumbnails/test/browser_thumbnails_background.js +++ b/toolkit/components/thumbnails/test/browser_thumbnails_background.js @@ -47,20 +47,29 @@ let tests = [ let urls = [ "http://www.example.com/0", "http://www.example.com/1", + // an item that will timeout to ensure timeouts work and we resume. + testPageURL({ wait: 2002 }), "http://www.example.com/2", ]; let files = urls.map(fileForURL); files.forEach(f => ok(!f.exists(), "Thumbnail should not be cached yet.")); urls.forEach(function (url) { + let isTimeoutTest = url.indexOf("?wait") >= 0; imports.BackgroundPageThumbs.capture(url, { + timeout: isTimeoutTest ? 100 : 30000, onDone: function onDone(capturedURL) { ok(urls.length > 0, "onDone called, so URLs should still remain"); is(capturedURL, urls.shift(), "Captured URL should be currently expected URL (i.e., " + "capture() callbacks should be called in the correct order)"); let file = files.shift(); - ok(file.exists(), - "Thumbnail should be cached after capture: " + file.path); + if (isTimeoutTest) { + ok(!file.exists(), + "Thumbnail shouldn't exist for timed out capture: " + file.path); + } else { + ok(file.exists(), + "Thumbnail should be cached after capture: " + file.path); + } if (!urls.length) deferred.resolve(); }, @@ -88,48 +97,6 @@ let tests = [ yield deferred.promise; }, - function timeoutQueueing() { - let deferred = imports.Promise.defer(); - let urls = [ - { url: testPageURL({ wait: 2000 }), timeout: 30000 }, - { url: testPageURL({ wait: 2001 }), timeout: 1000 }, - { url: testPageURL({ wait: 2002 }), timeout: 0 }, - ]; - - // The expected callback order is the reverse of the above, and the reverse - // of the order in which the captures are made. - let expectedOrder = urls.slice(); - expectedOrder.reverse(); - expectedOrder = expectedOrder.map(u => u.url); - - let files = expectedOrder.map(fileForURL); - files.forEach(f => ok(!f.exists(), "Thumbnail should not be cached yet.")); - - urls.forEach(function ({ url, timeout }) { - imports.BackgroundPageThumbs.capture(url, { - timeout: timeout, - onDone: function onDone(capturedURL) { - ok(expectedOrder.length > 0, - "onDone called, so URLs should still remain"); - is(capturedURL, expectedOrder.shift(), - "Captured URL should be currently expected URL (i.e., " + - "capture() callbacks should be called in the correct order)"); - let file = files.shift(); - if (timeout > 2000) - ok(file.exists(), - "Thumbnail should be cached after capture: " + file.path); - else - ok(!file.exists(), - "Capture timed out so thumbnail should not be cached: " + - file.path); - if (!expectedOrder.length) - deferred.resolve(); - }, - }); - }); - yield deferred.promise; - }, - function redirect() { let finalURL = "http://example.com/redirected"; let originalURL = testPageURL({ redirect: finalURL }); diff --git a/toolkit/components/typeaheadfind/Makefile.in b/toolkit/components/typeaheadfind/Makefile.in index 0524f3b2ab94..7948ee6dcd43 100644 --- a/toolkit/components/typeaheadfind/Makefile.in +++ b/toolkit/components/typeaheadfind/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk diff --git a/toolkit/components/url-classifier/Makefile.in b/toolkit/components/url-classifier/Makefile.in index c46b30d3728a..f8a78915b07b 100644 --- a/toolkit/components/url-classifier/Makefile.in +++ b/toolkit/components/url-classifier/Makefile.in @@ -12,7 +12,6 @@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS = 1 LOCAL_INCLUDES = \ diff --git a/toolkit/crashreporter/client/crashreporter.exe.manifest b/toolkit/crashreporter/client/crashreporter.exe.manifest index 30536306ac76..b1113274ec4d 100644 --- a/toolkit/crashreporter/client/crashreporter.exe.manifest +++ b/toolkit/crashreporter/client/crashreporter.exe.manifest @@ -28,7 +28,10 @@ - + + + + diff --git a/toolkit/identity/Makefile.in b/toolkit/identity/Makefile.in index 660372af49e6..ff9d29f6923e 100644 --- a/toolkit/identity/Makefile.in +++ b/toolkit/identity/Makefile.in @@ -11,7 +11,6 @@ include $(DEPTH)/config/autoconf.mk FAIL_ON_WARNINGS := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index c5b4f4f745e8..a1709736c815 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -491,8 +491,6 @@ endif EXTRA_DSO_LDOPTS += $(LIBS_DIR) -DEFINES += -DIMPL_XREAPI - EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) @@ -667,12 +665,7 @@ LOCAL_INCLUDES += \ OS_LIBS += $(LIBICONV) DEFINES += \ - -D_IMPL_NS_COM \ - -D_IMPL_NS_STRINGAPI \ - -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ - -D_IMPL_NS_GFX \ - -D_IMPL_NS_WIDGET \ + -DIMPL_LIBXUL \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),windows) diff --git a/toolkit/mozapps/update/common/Makefile.in b/toolkit/mozapps/update/common/Makefile.in index daf26cda760b..4295e12fd974 100644 --- a/toolkit/mozapps/update/common/Makefile.in +++ b/toolkit/mozapps/update/common/Makefile.in @@ -9,7 +9,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB =1 LIBXUL_LIBRARY = 1 ifeq ($(OS_ARCH),WINNT) USE_STATIC_LIBS = 1 diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index 8d60f90ccfb4..494a22020567 100644 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -142,6 +142,41 @@ var gUpdates = { */ _runUnload: true, + /** + * Submit the last page code when the wizard exited. The pageid is used to map + * to an integer instead of using the pageindex since pages can be added and + * removed which would change the page's pageindex. + * @param pageID + */ + _sendLastPageCodePing: function(pageID) { + var pageMap = { invalid: 0, + dummy: 1, + checking: 2, + pluginupdatesfound: 3, + noupdatesfound: 4, + manualUpdate: 5, + unsupported: 6, + incompatibleCheck: 7, + updatesfoundbasic: 8, + updatesfoundbillboard: 9, + license: 10, + incompatibleList: 11, + downloading: 12, + errors: 13, + errorextra: 14, + errorpatching: 15, + finished: 16, + finishedBackground: 17, + installed: 18 }; + try { + Services.telemetry.getHistogramById("UPDATER_WIZ_LAST_PAGE_CODE"). + add(pageMap[pageID] || pageMap.invalid); + } + catch (e) { + Components.utils.reportError(e); + } + }, + /** * Helper function for setButtons * Resets button to original label & accesskey if string is null. @@ -251,6 +286,7 @@ var gUpdates = { var pageid = document.documentElement.currentPage.pageid; if ("onWizardFinish" in this._pages[pageid]) this._pages[pageid].onWizardFinish(); + this._sendLastPageCodePing(pageid); }, /** @@ -262,6 +298,7 @@ var gUpdates = { var pageid = document.documentElement.currentPage.pageid; if ("onWizardCancel" in this._pages[pageid]) this._pages[pageid].onWizardCancel(); + this._sendLastPageCodePing(pageid); }, /** @@ -1838,7 +1875,6 @@ var gFinishedPage = { * in the wizard after an update has been downloaded. */ onExtra1: function() { - // XXXrstrong - reminding the user to restart is broken (see bug 464835) gUpdates.wiz.cancel(); } }; diff --git a/toolkit/mozapps/update/nsIUpdateService.idl b/toolkit/mozapps/update/nsIUpdateService.idl index fcbfbd4bcc28..45e111a3cb80 100644 --- a/toolkit/mozapps/update/nsIUpdateService.idl +++ b/toolkit/mozapps/update/nsIUpdateService.idl @@ -351,9 +351,15 @@ interface nsIUpdateChecker : nsISupports * background update checks and provides utilities for selecting and * downloading update patches. */ -[scriptable, uuid(814f185b-cac6-494b-8fd6-63cf7380d857)] +[scriptable, uuid(579ef84b-3e66-46fb-aeb4-799db5ade506)] interface nsIApplicationUpdateService : nsISupports { + /** + * Checks for available updates in the background using the listener provided + * by the application update service for background checks. + */ + void checkForBackgroundUpdates(); + /** * The Update Checker used for background update checking. */ diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 9dee023db525..d00d90742027 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -36,6 +36,7 @@ const PREF_APP_UPDATE_METRO_ENABLED = "app.update.metro.enabled"; const PREF_APP_UPDATE_IDLETIME = "app.update.idletime"; const PREF_APP_UPDATE_INCOMPATIBLE_MODE = "app.update.incompatible.mode"; const PREF_APP_UPDATE_INTERVAL = "app.update.interval"; +const PREF_APP_UPDATE_LASTUPDATETIME = "app.update.lastUpdateTime.background-update-timer"; const PREF_APP_UPDATE_LOG = "app.update.log"; const PREF_APP_UPDATE_MODE = "app.update.mode"; const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never."; @@ -181,6 +182,77 @@ const DEFAULT_SOCKET_MAX_ERRORS = 10; // The number of milliseconds to wait before retrying a connection error. const DEFAULT_UPDATE_RETRY_TIMEOUT = 2000; +// A background download is in progress (no notification) +const PING_BGUC_IS_DOWNLOADING = 0; +// An update is staged (no notification) +const PING_BGUC_IS_STAGED = 1; +// Invalid url for app.update.url default preference (no notification) +const PING_BGUC_INVALID_DEFAULT_URL = 2; +// Invalid url for app.update.url user preference (no notification) +const PING_BGUC_INVALID_CUSTOM_URL = 3; +// Invalid url for app.update.url.override user preference (no notification) +const PING_BGUC_INVALID_OVERRIDE_URL = 4; +// Unable to check for updates per gCanCheckForUpdates (no notification) +const PING_BGUC_UNABLE_TO_CHECK = 5; +// Already has an active update in progress (no notification) +const PING_BGUC_HAS_ACTIVEUPDATE = 6; +// Background checks disabled by preference (no notification) +const PING_BGUC_PREF_DISABLED = 7; +// Background checks disabled for the current session (no notification) +const PING_BGUC_DISABLED_FOR_SESSION = 8; +// Background checks disabled in Metro (no notification) +const PING_BGUC_METRO_DISABLED = 9; +// Unable to perform a background check while offline (no notification) +const PING_BGUC_OFFLINE = 10; +// No update found certificate check failed and threshold reached +// (possible mitm attack notification) +const PING_BGUC_CERT_ATTR_NO_UPDATE_NOTIFY = 11; +// No update found certificate check failed and threshold not reached +// (no notification) +const PING_BGUC_CERT_ATTR_NO_UPDATE_SILENT = 12; +// Update found certificate check failed and threshold reached +// (possible mitm attack notification) +const PING_BGUC_CERT_ATTR_WITH_UPDATE_NOTIFY = 13; +// Update found certificate check failed and threshold not reached +// (no notification) +const PING_BGUC_CERT_ATTR_WITH_UPDATE_SILENT = 14; +// General update check failure and threshold reached +// (check failure notification) +const PING_BGUC_GENERAL_ERROR_NOTIFY = 15; +// General update check failure and threshold not reached +// (no notification) +const PING_BGUC_GENERAL_ERROR_SILENT = 16; +// No update found (no notification) +const PING_BGUC_NO_UPDATE_FOUND = 17; +// No compatible update found though there were updates (no notification) +const PING_BGUC_NO_COMPAT_UPDATE_FOUND = 18; +// Update found for a previous version (no notification) +const PING_BGUC_UPDATE_PREVIOUS_VERSION = 19; +// Update found for a version with the never preference set (no notification) +const PING_BGUC_UPDATE_NEVER_PREF = 20; +// Update found without a type attribute (no notification) +const PING_BGUC_UPDATE_INVALID_TYPE = 21; +// The system is no longer supported (system unsupported notification) +const PING_BGUC_UNSUPPORTED = 22; +// Unable to apply updates (manual install to update notification) +const PING_BGUC_UNABLE_TO_APPLY = 23; +// Showing prompt due to the update.xml specifying showPrompt +// (update notification) +const PING_BGUC_SHOWPROMPT_SNIPPET = 24; +// Showing prompt due to preference (update notification) +const PING_BGUC_SHOWPROMPT_PREF = 25; +// Incompatible add-on check disabled by preference (background download) +const PING_BGUC_ADDON_PREF_DISABLED = 26; +// Incompatible add-on not checked not performed due to same update version and +// app version (background download) +const PING_BGUC_ADDON_SAME_APP_VER = 27; +// No incompatible add-ons found during incompatible check (background download) +const PING_BGUC_CHECK_NO_INCOMPAT = 28; +// Incompatible add-ons found and all of them have updates (background download) +const PING_BGUC_ADDON_UPDATES_FOR_INCOMPAT = 29; +// Incompatible add-ons found (update notification) +const PING_BGUC_ADDON_HAVE_INCOMPAT = 30; + var gLocale = null; #ifdef MOZ_B2G @@ -206,7 +278,7 @@ XPCOMUtils.defineLazyGetter(this, "gUpdateBundle", function aus_gUpdateBundle() // shared code for suppressing bad cert dialogs XPCOMUtils.defineLazyGetter(this, "gCertUtils", function aus_gCertUtils() { let temp = { }; - Components.utils.import("resource://gre/modules/CertUtils.jsm", temp); + Cu.import("resource://gre/modules/CertUtils.jsm", temp); return temp; }); @@ -416,7 +488,6 @@ function createMutex(name, aAllowExisting) { aAllowExisting = true; } - Components.utils.import("resource://gre/modules/ctypes.jsm"); const INITIAL_OWN = 1; const ERROR_ALREADY_EXISTS = 0xB7; var lib = ctypes.open("kernel32.dll"); @@ -452,15 +523,14 @@ function getPerInstallationMutexName(aGlobal) { if (aGlobal === undefined) { aGobal = true; } - let hasher = Components.classes["@mozilla.org/security/hash;1"]. - createInstance(Components.interfaces.nsICryptoHash); - hasher.init(hasher.SHA1); + let hasher = Cc["@mozilla.org/security/hash;1"]. + createInstance(Ci.nsICryptoHash); + hasher.init(hasher.SHA1); - Components.utils.import("resource://gre/modules/Services.jsm"); - var exeFile = Services.dirsvc.get(KEY_EXECUTABLE, Components.interfaces.nsILocalFile); + var exeFile = Services.dirsvc.get(KEY_EXECUTABLE, Ci.nsILocalFile); - let converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. - createInstance(Components.interfaces.nsIScriptableUnicodeConverter); + let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]. + createInstance(Ci.nsIScriptableUnicodeConverter); converter.charset = "UTF-8"; var data = converter.convertToByteArray(exeFile.path.toLowerCase()); @@ -1016,10 +1086,10 @@ function isInterruptedUpdate(status) { /** * Releases any SDCard mount lock that we might have. * - * This once again allows the SDCard to be shared with the PC. - * - * This function was placed outside the #ifdef so that we didn't - * need to put #ifdefs around the callers + * This once again allows the SDCard to be shared with the PC. + * + * This function was placed outside the #ifdef so that we didn't + * need to put #ifdefs around the callers. */ function releaseSDCardMountLock() { #ifdef MOZ_WIDGET_GONK @@ -1072,9 +1142,9 @@ function writeVersionFile(dir, version) { */ function cleanUpMozUpdaterDirs() { try { - var tmpDir = Components.classes["@mozilla.org/file/directory_service;1"]. - getService(Components.interfaces.nsIProperties). - get("TmpD", Components.interfaces.nsIFile); + var tmpDir = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + get("TmpD", Ci.nsIFile); // We used to store MozUpdater-i folders directly inside the temp directory. // We need to cleanup these directories if we detect that they still exist. @@ -1088,7 +1158,7 @@ function cleanUpMozUpdaterDirs() { let i = 0; let dirEntries = tmpDir.directoryEntries; while (dirEntries.hasMoreElements() && i < 10) { - let file = dirEntries.getNext().QueryInterface(Components.interfaces.nsILocalFile); + let file = dirEntries.getNext().QueryInterface(Ci.nsILocalFile); if (file.leafName.startsWith("MozUpdater-") && file.leafName != "MozUpdater-1") { file.remove(true); i++; @@ -1389,9 +1459,22 @@ function handleUpdateFailure(update, errorCode) { } writeStatusFile(getUpdatesDir(), update.state = STATE_PENDING); + try { + Services.telemetry.getHistogramById("UPDATER_SERVICE_ERROR_CODE"). + add(update.errorCode); + } + catch (e) { + Cu.reportError(e); + } return true; } + try { + Services.telemetry.getHistogramById("UPDATER_SERVICE_ERROR_CODE").add(0); + } + catch (e) { + Cu.reportError(e); + } return false; } @@ -1855,7 +1938,7 @@ const UpdateServiceFactory = { _instance: null, createInstance: function (outer, iid) { if (outer != null) - throw Components.results.NS_ERROR_NO_AGGREGATION; + throw Cr.NS_ERROR_NO_AGGREGATION; return this._instance == null ? this._instance = new UpdateService() : this._instance; } @@ -1905,6 +1988,12 @@ UpdateService.prototype = { */ _retryTimer: null, + /** + * Whether or not a background update check was initiated by the + * application update timer notification. + */ + _isNotify: true, + /** * Handle Observer Service notifications * @param subject @@ -2088,28 +2177,6 @@ UpdateService.prototype = { this._sendStatusCodeTelemetryPing(status); if (status == STATE_SUCCEEDED) { - // Report telemetry that we want after each successful update. - // We do this only on successful updates so that we only get - // one report from each user for each version. If a user cancels - // UAC for example, we don't want 2 reports from them on the same - // version. - this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_ENABLED, - "UPDATER_UPDATES_ENABLED"); - this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_METRO_ENABLED, - "UPDATER_UPDATES_METRO_ENABLED"); - this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_AUTO, - "UPDATER_UPDATES_AUTOMATIC"); - this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_STAGING_ENABLED, - "UPDATER_STAGE_ENABLED"); - -#ifdef XP_WIN - this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ENABLED, - "UPDATER_SERVICE_ENABLED"); - this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS, - "UPDATER_SERVICE_ERRORS"); - this._sendServiceInstalledTelemetryPing(); -#endif - update.statusText = gUpdateBundle.GetStringFromName("installSuccess"); // Update the patch's metadata. @@ -2164,7 +2231,7 @@ UpdateService.prototype = { Services.telemetry.getHistogramById(histogram).add(+val); } catch(e) { // Don't allow any exception to be propagated. - Components.utils.reportError(e); + Cu.reportError(e); } }, @@ -2179,8 +2246,8 @@ UpdateService.prototype = { let installed = 0; let attempted = 0; try { - let wrk = Components.classes["@mozilla.org/windows-registry-key;1"] - .createInstance(Components.interfaces.nsIWindowsRegKey); + let wrk = Cc["@mozilla.org/windows-registry-key;1"]. + createInstance(Ci.nsIWindowsRegKey); wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\MaintenanceService", wrk.ACCESS_READ | wrk.WOW64_64); @@ -2194,14 +2261,14 @@ UpdateService.prototype = { h.add(installed); } catch(e) { // Don't allow any exception to be propagated. - Components.utils.reportError(e); + Cu.reportError(e); } try { let h = Services.telemetry.getHistogramById("UPDATER_SERVICE_MANUALLY_UNINSTALLED"); h.add(!installed && attempted ? 1 : 0); } catch(e) { // Don't allow any exception to be propagated. - Components.utils.reportError(e); + Cu.reportError(e); } }, #endif @@ -2223,7 +2290,7 @@ UpdateService.prototype = { Services.telemetry.getHistogramById(histogram).add(val); } catch(e) { // Don't allow any exception to be propagated. - Components.utils.reportError(e); + Cu.reportError(e); } }, @@ -2239,7 +2306,7 @@ UpdateService.prototype = { let parts = status.split(":"); if ((parts.length == 1 && status != STATE_SUCCEEDED) || (parts.length > 1 && parts[0] != STATE_FAILED)) { - // we only want to report success or failure + // Should also report STATE_DOWNLOAD_FAILED return; } let result = 0; // 0 means success @@ -2249,7 +2316,62 @@ UpdateService.prototype = { Services.telemetry.getHistogramById("UPDATER_STATUS_CODES").add(result); } catch(e) { // Don't allow any exception to be propagated. - Components.utils.reportError(e); + Cu.reportError(e); + } + }, + + /** + * Submit the interval in days since the last notification for this background + * update check. + */ + _sendLastNotifyIntervalPing: function AUS__notifyIntervalPing() { + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LASTUPDATETIME)) { + let idSuffix = this._isNotify ? "NOTIFY" : "EXTERNAL"; + let lastUpdateTimeSeconds = getPref("getIntPref", + PREF_APP_UPDATE_LASTUPDATETIME, 0); + if (lastUpdateTimeSeconds) { + let currentTimeSeconds = Math.round(Date.now() / 1000); + if (lastUpdateTimeSeconds > currentTimeSeconds) { + try { + Services.telemetry. + getHistogramById("UPDATER_INVALID_LASTUPDATETIME_" + idSuffix). + add(1); + } catch(e) { + Cu.reportError(e); + } + } + else { + let intervalDays = (currentTimeSeconds - lastUpdateTimeSeconds) / + (60 * 60 * 24); + try { + Services.telemetry. + getHistogramById("UPDATER_INVALID_LASTUPDATETIME_" + idSuffix). + add(0); + Services.telemetry. + getHistogramById("UPDATER_LAST_NOTIFY_INTERVAL_DAYS_" + idSuffix). + add(intervalDays); + } catch(e) { + Cu.reportError(e); + } + } + } + } + }, + + /** + * Submit the result for the background update check. + * + * @param code + * An integer value as defined by the PING_BGUC_* constants. + */ + _backgroundUpdateCheckCodePing: function AUS__backgroundUpdateCheckCodePing(code) { + try { + let idSuffix = this._isNotify ? "NOTIFY" : "EXTERNAL"; + Services.telemetry. + getHistogramById("UPDATER_BACKGROUND_CHECK_CODE_" + idSuffix).add(code); + } + catch (e) { + Cu.reportError(e); } }, @@ -2301,10 +2423,12 @@ UpdateService.prototype = { if (update.errorCode == NETWORK_ERROR_OFFLINE) { // Register an online observer to try again this._registerOnlineObserver(); + this._backgroundUpdateCheckCodePing(PING_BGUC_OFFLINE); return; } - else if (update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE || - update.errorCode == CERT_ATTR_CHECK_FAILED_HAS_UPDATE) { + + if (update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE || + update.errorCode == CERT_ATTR_CHECK_FAILED_HAS_UPDATE) { errCount = getPref("getIntPref", PREF_APP_UPDATE_CERT_ERRORS, 0); errCount++; Services.prefs.setIntPref(PREF_APP_UPDATE_CERT_ERRORS, errCount); @@ -2319,14 +2443,38 @@ UpdateService.prototype = { 10); } + var pingCode; if (errCount >= maxErrors) { var prompter = Cc["@mozilla.org/updates/update-prompt;1"]. createInstance(Ci.nsIUpdatePrompt); prompter.showUpdateError(update); + + switch (update.errorCode) { + case CERT_ATTR_CHECK_FAILED_NO_UPDATE: + pingCode = PING_BGUC_CERT_ATTR_NO_UPDATE_NOTIFY; + break; + case CERT_ATTR_CHECK_FAILED_HAS_UPDATE: + pingCode = PING_BGUC_CERT_ATTR_WITH_UPDATE_NOTIFY; + break; + default: + pingCode = PING_BGUC_GENERAL_ERROR_NOTIFY; + } + } + else { + switch (update.errorCode) { + case CERT_ATTR_CHECK_FAILED_NO_UPDATE: + pingCode = PING_BGUC_CERT_ATTR_NO_UPDATE_SILENT; + break; + case CERT_ATTR_CHECK_FAILED_HAS_UPDATE: + pingCode = PING_BGUC_CERT_ATTR_WITH_UPDATE_SILENT; + break; + default: + pingCode = PING_BGUC_GENERAL_ERROR_SILENT; + } } + this._backgroundUpdateCheckCodePing(pingCode); }, - /** * Called when a connection should be resumed */ @@ -2358,12 +2506,89 @@ UpdateService.prototype = { * The timer that fired */ notify: function AUS_notify(timer) { + this._checkForBackgroundUpdates(true); + }, + + /** + * See nsIUpdateService.idl + */ + checkForBackgroundUpdates: function AUS_checkForBackgroundUpdates() { + this._checkForBackgroundUpdates(false); + }, + + /** + * Checks for updates in the background. + * @param isNotify + * Whether or not a background update check was initiated by the + * application update timer notification. + */ + _checkForBackgroundUpdates: function AUS__checkForBackgroundUpdates(isNotify) { + this._isNotify = isNotify; + // This ensures that telemetry is gathered even if update is disabled. + this._sendLastNotifyIntervalPing(); + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_ENABLED, + "UPDATER_UPDATES_ENABLED"); + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_METRO_ENABLED, + "UPDATER_UPDATES_METRO_ENABLED"); + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_AUTO, + "UPDATER_UPDATES_AUTOMATIC"); + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_STAGING_ENABLED, + "UPDATER_STAGE_ENABLED"); + +#ifdef XP_WIN + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ENABLED, + "UPDATER_SERVICE_ENABLED"); + this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS, + "UPDATER_SERVICE_ERRORS"); + this._sendServiceInstalledTelemetryPing(); +#endif + // If a download is in progress or the patch has been staged do nothing. - if (this.isDownloading || - this._downloader && this._downloader.patchIsStaged) { + if (this.isDownloading) { + this._backgroundUpdateCheckCodePing(PING_BGUC_IS_DOWNLOADING); + return; + } + + if (this._downloader && this._downloader.patchIsStaged) { + this._backgroundUpdateCheckCodePing(PING_BGUC_IS_STAGED); return; } + // The following checks will return early without notification in the call + // to checkForUpdates below. To simplify the background update check ping + // their values are checked here. + try { + if (!this.backgroundChecker.getUpdateURL(false)) { + let prefs = Services.prefs; + if (!prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) { + if (!prefs.prefHasUserValue(PREF_APP_UPDATE_URL)) { + this._backgroundUpdateCheckCodePing(PING_BGUC_INVALID_DEFAULT_URL); + } + else { + this._backgroundUpdateCheckCodePing(PING_BGUC_INVALID_CUSTOM_URL); + } + } + else { + this._backgroundUpdateCheckCodePing(PING_BGUC_INVALID_OVERRIDE_URL); + } + } + else if (!gMetroUpdatesEnabled) { + this._backgroundUpdateCheckCodePing(PING_BGUC_METRO_DISABLED); + } + else if (!getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true)) { + this._backgroundUpdateCheckCodePing(PING_BGUC_PREF_DISABLED); + } + else if (!gCanCheckForUpdates) { + this._backgroundUpdateCheckCodePing(PING_BGUC_UNABLE_TO_CHECK); + } + else if (!this.backgroundChecker._enabled) { + this._backgroundUpdateCheckCodePing(PING_BGUC_DISABLED_FOR_SESSION); + } + } + catch (e) { + Cu.reportError(e); + } + this.backgroundChecker.checkForUpdates(this, false); }, @@ -2376,9 +2601,12 @@ UpdateService.prototype = { * @return The nsIUpdate to offer. */ selectUpdate: function AUS_selectUpdate(updates) { - if (updates.length == 0) + if (updates.length == 0) { + this._backgroundUpdateCheckCodePing(PING_BGUC_NO_UPDATE_FOUND); return null; + } + // The ping for unsupported is sent after the call to showPrompt. if (updates.length == 1 && updates[0].unsupported) return updates[0]; @@ -2386,6 +2614,7 @@ UpdateService.prototype = { var majorUpdate = null; var minorUpdate = null; var vc = Services.vc; + var lastPingCode = PING_BGUC_NO_COMPAT_UPDATE_FOUND; updates.forEach(function(aUpdate) { // Ignore updates for older versions of the application and updates for @@ -2396,6 +2625,7 @@ UpdateService.prototype = { LOG("UpdateService:selectUpdate - skipping update because the " + "update's application version is less than the current " + "application version"); + lastPingCode = PING_BGUC_UPDATE_PREVIOUS_VERSION; return; } @@ -2407,6 +2637,7 @@ UpdateService.prototype = { getPref("getBoolPref", neverPrefName, false)) { LOG("UpdateService:selectUpdate - skipping update because the " + "preference " + neverPrefName + " is true"); + lastPingCode = PING_BGUC_UPDATE_NEVER_PREF; return; } @@ -2426,11 +2657,16 @@ UpdateService.prototype = { default: LOG("UpdateService:selectUpdate - skipping unknown update type: " + aUpdate.type); + lastPingCode = PING_BGUC_UPDATE_INVALID_TYPE; break; } }); - return minorUpdate || majorUpdate; + var update = minorUpdate || majorUpdate; + if (!update) + this._backgroundUpdateCheckCodePing(lastPingCode); + + return update; }, /** @@ -2456,17 +2692,20 @@ UpdateService.prototype = { // to show the prompt to make sure. this._showPrompt(um.activeUpdate); #endif + this._backgroundUpdateCheckCodePing(PING_BGUC_HAS_ACTIVEUPDATE); return; } var updateEnabled = getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true); if (!updateEnabled) { + this._backgroundUpdateCheckCodePing(PING_BGUC_PREF_DISABLED); LOG("UpdateService:_selectAndInstallUpdate - not prompting because " + "update is disabled"); return; } if (!gMetroUpdatesEnabled) { + this._backgroundUpdateCheckCodePing(PING_BGUC_METRO_DISABLED); return; } @@ -2483,6 +2722,7 @@ UpdateService.prototype = { "update is not supported for this system"); this._showPrompt(update); } + this._backgroundUpdateCheckCodePing(PING_BGUC_UNSUPPORTED); return; } @@ -2490,6 +2730,7 @@ UpdateService.prototype = { LOG("UpdateService:_selectAndInstallUpdate - the user is unable to " + "apply updates... prompting"); this._showPrompt(update); + this._backgroundUpdateCheckCodePing(PING_BGUC_UNABLE_TO_APPLY); return; } @@ -2524,6 +2765,7 @@ UpdateService.prototype = { "update snippet specified showPrompt"); this._showPrompt(update); if (!gIsMetro) { + this._backgroundUpdateCheckCodePing(PING_BGUC_SHOWPROMPT_SNIPPET); return; } } @@ -2533,17 +2775,19 @@ UpdateService.prototype = { "install is disabled"); this._showPrompt(update); if (!gIsMetro) { + this._backgroundUpdateCheckCodePing(PING_BGUC_SHOWPROMPT_PREF); return; } } if (getPref("getIntPref", PREF_APP_UPDATE_MODE, 1) == 0) { // Do not prompt regardless of add-on incompatibilities - LOG("UpdateService:_selectAndInstallUpdate - no need to show prompt, " + - "just download the update"); + LOG("UpdateService:_selectAndInstallUpdate - add-on compatibility " + + "check disabled by preference, just download the update"); var status = this.downloadUpdate(update, true); if (status == STATE_NONE) cleanupActiveUpdate(); + this._backgroundUpdateCheckCodePing(PING_BGUC_ADDON_PREF_DISABLED); return; } @@ -2554,11 +2798,13 @@ UpdateService.prototype = { this._checkAddonCompatibility(); } else { - LOG("UpdateService:_selectAndInstallUpdate - no need to show prompt, " + - "just download the update"); + LOG("UpdateService:_selectAndInstallUpdate - add-on compatibility " + + "check not performed due to the update version being the same as " + + "the current application version, just download the update"); var status = this.downloadUpdate(update, true); if (status == STATE_NONE) cleanupActiveUpdate(); + this._backgroundUpdateCheckCodePing(PING_BGUC_ADDON_SAME_APP_VER); } }, @@ -2586,7 +2832,7 @@ UpdateService.prototype = { "or the findUpdates method!"; if (addon.id) errMsg += " Add-on ID: " + addon.id; - Components.utils.reportError(errMsg); + Cu.reportError(errMsg); return; } @@ -2610,7 +2856,7 @@ UpdateService.prototype = { self._incompatibleAddons.push(addon); } catch (e) { - Components.utils.reportError(e); + Cu.reportError(e); } }); @@ -2645,12 +2891,13 @@ UpdateService.prototype = { }, self); } else { - LOG("UpdateService:_checkAddonCompatibility - no need to show prompt, " + - "just download the update"); + LOG("UpdateService:_checkAddonCompatibility - no incompatible " + + "add-ons found, just download the update"); var status = self.downloadUpdate(self._update, true); if (status == STATE_NONE) cleanupActiveUpdate(); self._update = null; + this._backgroundUpdateCheckCodePing(PING_BGUC_CHECK_NO_INCOMPAT); } }); }, @@ -2694,13 +2941,15 @@ UpdateService.prototype = { LOG("UpdateService:onUpdateEnded - prompting because there are " + "incompatible add-ons"); this._showPrompt(this._update); + this._backgroundUpdateCheckCodePing(PING_BGUC_ADDON_HAVE_INCOMPAT); } else { - LOG("UpdateService:onUpdateEnded - no need to show prompt, just " + - "download the update"); + LOG("UpdateService:_selectAndInstallUpdate - updates for all " + + "incompatible add-ons found, just download the update"); var status = this.downloadUpdate(this._update, true); if (status == STATE_NONE) cleanupActiveUpdate(); + this._backgroundUpdateCheckCodePing(PING_BGUC_ADDON_UPDATES_FOR_INCOMPAT); } this._update = null; }, @@ -4225,7 +4474,7 @@ Downloader.prototype = { createInstance(); return prompt.QueryInterface(iid); } - throw Components.results.NS_NOINTERFACE; + throw Cr.NS_NOINTERFACE; }, QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver, diff --git a/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul b/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul index d126f941c370..79de422d8382 100644 --- a/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul +++ b/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul @@ -35,7 +35,7 @@ function runTest() { let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams(); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul b/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul index ede310226548..b489768b4067 100644 --- a/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul +++ b/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul @@ -76,7 +76,7 @@ function runTest() { getVersionParams(); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul b/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul index f211a2ea979d..34bc09b67414 100644 --- a/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul +++ b/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul @@ -40,7 +40,7 @@ function runTest() { getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul b/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul index 3f6d102ea6bf..c3690129b907 100644 --- a/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul +++ b/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul @@ -80,7 +80,7 @@ function runTest() { getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul b/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul index 51641d75d1a9..29c848aa4f10 100644 --- a/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul +++ b/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul @@ -49,7 +49,7 @@ function runTest() { getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul b/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul index 9db8845f0133..4f8bb966446c 100644 --- a/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul +++ b/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul @@ -89,7 +89,7 @@ function runTest() { getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0037_available_staging_basic.xul b/toolkit/mozapps/update/test/chrome/test_0037_available_staging_basic.xul index 5ce498fe801a..68ddc9ccfe58 100644 --- a/toolkit/mozapps/update/test/chrome/test_0037_available_staging_basic.xul +++ b/toolkit/mozapps/update/test/chrome/test_0037_available_staging_basic.xul @@ -39,7 +39,7 @@ function runTest() { setupTimer(90000); // 90 seconds - gAUS.notify(null); + gAUS.checkForBackgroundUpdates(); } ]]> diff --git a/toolkit/mozapps/update/updater/updater.exe.manifest b/toolkit/mozapps/update/updater/updater.exe.manifest index 4825ed1ff360..444dce2d14a7 100644 --- a/toolkit/mozapps/update/updater/updater.exe.manifest +++ b/toolkit/mozapps/update/updater/updater.exe.manifest @@ -28,10 +28,10 @@ - - - - + + + + diff --git a/toolkit/profile/Makefile.in b/toolkit/profile/Makefile.in index 7b75a3e30b44..181c931ac482 100644 --- a/toolkit/profile/Makefile.in +++ b/toolkit/profile/Makefile.in @@ -10,7 +10,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES = \ @@ -18,8 +17,6 @@ LOCAL_INCLUDES = \ -I$(topsrcdir)/profile/dirserviceprovider/src \ $(NULL) -DEFINES += -DIMPL_XREAPI - GARBAGE += nsProfileLock.cpp include $(topsrcdir)/config/rules.mk diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index 28621dc7e524..17caef312acd 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -21,13 +21,11 @@ LIBRARY_NAME = xulapp_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -FORCE_STATIC_LIB = 1 - ifeq ($(MOZ_GL_DEFAULT_PROVIDER),GLX) DEFINES += -DUSE_GLX_TEST endif -DEFINES += -DIMPL_XREAPI \ +DEFINES += \ -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"' \ -DMOZ_APP_VERSION='"$(MOZ_APP_VERSION)"' diff --git a/tools/profiler/platform-linux.cc b/tools/profiler/platform-linux.cc index ef0f68b1bb9f..abafadc5f18b 100644 --- a/tools/profiler/platform-linux.cc +++ b/tools/profiler/platform-linux.cc @@ -53,6 +53,7 @@ #include // open #include // open #include // sysconf +#include #ifdef __GLIBC__ #include // backtrace, backtrace_symbols #endif // def __GLIBC__ @@ -62,6 +63,7 @@ #include "platform.h" #include "GeckoProfilerImpl.h" #include "mozilla/Mutex.h" +#include "mozilla/Atomics.h" #include "ProfileEntry.h" #include "nsThreadUtils.h" #include "TableTicker.h" @@ -140,7 +142,8 @@ struct SamplerRegistry { Sampler *SamplerRegistry::sampler = NULL; -static ThreadProfile* sCurrentThreadProfile = NULL; +static mozilla::Atomic sCurrentThreadProfile; +static sem_t sSignalHandlingDone; static void ProfilerSaveSignalHandler(int signal, siginfo_t* info, void* context) { Sampler::GetActiveSampler()->RequestSave(); @@ -204,6 +207,7 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { Sampler::GetActiveSampler()->Tick(sample); sCurrentThreadProfile = NULL; + sem_post(&sSignalHandlingDone); } int tgkill(pid_t tgid, pid_t tid, int signalno) { @@ -270,8 +274,7 @@ static void* SignalSender(void* arg) { } // Wait for the signal handler to run before moving on to the next one - while (sCurrentThreadProfile) - sched_yield(); + sem_wait(&sSignalHandlingDone); } } @@ -304,6 +307,13 @@ void Sampler::Start() { SamplerRegistry::AddActiveSampler(this); + // Initialize signal handler communication + sCurrentThreadProfile = NULL; + if (sem_init(&sSignalHandlingDone, /* pshared: */ 0, /* value: */ 0) != 0) { + LOG("Error initializing semaphore"); + return; + } + // Request profiling signals. LOG("Request signal"); struct sigaction sa; diff --git a/tools/trace-malloc/lib/Makefile.in b/tools/trace-malloc/lib/Makefile.in index e96c0f688a8d..b46b484855da 100644 --- a/tools/trace-malloc/lib/Makefile.in +++ b/tools/trace-malloc/lib/Makefile.in @@ -13,8 +13,6 @@ include $(DEPTH)/config/autoconf.mk EXPORT_LIBRARY = 1 DEFFILE = $(win_srcdir)/tm.def -FORCE_STATIC_LIB = 1 - LIBXUL_LIBRARY = 1 STL_FLAGS = diff --git a/uriloader/base/Makefile.in b/uriloader/base/Makefile.in index 20676731a9e3..dc9ad52d4741 100644 --- a/uriloader/base/Makefile.in +++ b/uriloader/base/Makefile.in @@ -14,8 +14,5 @@ MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in index 24cb887c6938..7d980de99862 100644 --- a/uriloader/exthandler/Makefile.in +++ b/uriloader/exthandler/Makefile.in @@ -83,8 +83,6 @@ EXTRA_COMPONENTS = \ nsWebHandlerApp.manifest \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/uriloader/prefetch/Makefile.in b/uriloader/prefetch/Makefile.in index 63b87a59a6a9..77b087eb37a1 100644 --- a/uriloader/prefetch/Makefile.in +++ b/uriloader/prefetch/Makefile.in @@ -19,9 +19,6 @@ LOCAL_INCLUDES = \ -I$(topsrcdir)/content/events/src \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/view/src/Makefile.in b/view/src/Makefile.in index 32861f3900f8..db8035118e6a 100644 --- a/view/src/Makefile.in +++ b/view/src/Makefile.in @@ -11,7 +11,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MSVC_ENABLE_PGO := 1 -FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/webapprt/win/webapprt.exe.manifest b/webapprt/win/webapprt.exe.manifest index 590f0ae7b56a..0ccfd224f97b 100644 --- a/webapprt/win/webapprt.exe.manifest +++ b/webapprt/win/webapprt.exe.manifest @@ -33,7 +33,10 @@ - + + + + diff --git a/widget/android/Makefile.in b/widget/android/Makefile.in index 71e3503aafde..2b708c178a2c 100644 --- a/widget/android/Makefile.in +++ b/widget/android/Makefile.in @@ -34,7 +34,6 @@ SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_WIDGET #DEFINES += -DDEBUG_WIDGETS LOCAL_INCLUDES += \ diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index db29df37541e..3daba11129d4 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2577,7 +2577,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8) const nsIntPoint& aLocation, const gfx3DMatrix& aTransform) { - ShaderProgramOGL* program = aManager->GetProgram(BGRARectLayerProgramType); + ShaderProgramOGL* program = aManager->GetProgram(RGBARectLayerProgramType); aManager->gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, mTexture); diff --git a/widget/gonk/Makefile.in b/widget/gonk/Makefile.in index 3a3903f087e0..e5d93c4b63e2 100644 --- a/widget/gonk/Makefile.in +++ b/widget/gonk/Makefile.in @@ -30,7 +30,7 @@ SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_WIDGET -DHAVE_OFF64_T -DSK_BUILD_FOR_ANDROID_NDK +DEFINES += -DHAVE_OFF64_T -DSK_BUILD_FOR_ANDROID_NDK LOCAL_INCLUDES += \ -I$(ANDROID_SOURCE)/hardware/libhardware/include \ diff --git a/widget/os2/Makefile.in b/widget/os2/Makefile.in index c2d939a0b41c..0de7b07f6bd9 100644 --- a/widget/os2/Makefile.in +++ b/widget/os2/Makefile.in @@ -23,8 +23,6 @@ include $(topsrcdir)/config/rules.mk CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS) -DEFINES += -D_IMPL_NS_WIDGET - DEFINES += -DUSE_OS2_TOOLKIT_HEADERS DEFINES += -DMOZ_APP_DISPLAYNAME=\"$(MOZ_APP_DISPLAYNAME)\" diff --git a/widget/qt/Makefile.in b/widget/qt/Makefile.in index 7fbacb44da9b..da58a9a1f9d3 100644 --- a/widget/qt/Makefile.in +++ b/widget/qt/Makefile.in @@ -30,7 +30,6 @@ CXXFLAGS += $(MOZ_QT_CFLAGS) $(GLIB_CFLAGS) $(MOZ_CAIRO_CFLAGS) \ CFLAGS += $(MOZ_QT_CFLAGS) $(GLIB_CFLAGS) $(MOZ_CAIRO_CFLAGS) \ $(MOZ_PIXMAN_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS) -DEFINES += -D_IMPL_NS_WIDGET #DEFINES += -DDEBUG_WIDGETS ifeq ($(OS_ARCH), Linux) diff --git a/widget/shared/Makefile.in b/widget/shared/Makefile.in index 8193cd68d3a3..aaccf5c7aa58 100644 --- a/widget/shared/Makefile.in +++ b/widget/shared/Makefile.in @@ -13,14 +13,6 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = widget_shared LIBXUL_LIBRARY = 1 - -DEFINES += \ - -D_IMPL_NS_WIDGET \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/widget/shared/x11/Makefile.in b/widget/shared/x11/Makefile.in index 3737933f9f2b..3d3c00117b42 100644 --- a/widget/shared/x11/Makefile.in +++ b/widget/shared/x11/Makefile.in @@ -18,9 +18,6 @@ CSRCS = \ keysym2ucs.c \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk diff --git a/widget/windows/Makefile.in b/widget/windows/Makefile.in index 5ded723a5546..e15388a0de7c 100644 --- a/widget/windows/Makefile.in +++ b/widget/windows/Makefile.in @@ -16,7 +16,7 @@ EXPORT_LIBRARY = 1 RESFILE = widget.res LIBXUL_LIBRARY = 1 -DEFINES += -D_IMPL_NS_WIDGET -DMOZ_UNICODE +DEFINES += -DMOZ_UNICODE ifdef MOZ_ENABLE_D3D9_LAYER DEFINES += -DMOZ_ENABLE_D3D9_LAYER @@ -42,8 +42,6 @@ LOCAL_INCLUDES = \ -I$(topsrcdir)/content/events/src \ $(NULL) -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h index 0a74dbcb8b1a..5817232fc255 100644 --- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -44,10 +44,9 @@ class WinUtils { WINXP_VERSION = 0x501, WIN2K3_VERSION = 0x502, VISTA_VERSION = 0x600, - // WIN2K8_VERSION = VISTA_VERSION, WIN7_VERSION = 0x601, - // WIN2K8R2_VERSION = WIN7_VERSION - WIN8_VERSION = 0x602 + WIN8_VERSION = 0x602, + WIN8_1_VERSION = 0x603 }; static WinVersion GetWindowsVersion(); diff --git a/widget/windows/winrt/Makefile.in b/widget/windows/winrt/Makefile.in index 8d1f39188f96..d2f7a8e2ecd6 100644 --- a/widget/windows/winrt/Makefile.in +++ b/widget/windows/winrt/Makefile.in @@ -13,7 +13,7 @@ LIBRARY_NAME = widget_winrt EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 -DEFINES += -D_IMPL_NS_WIDGET -DMOZ_UNICODE +DEFINES += -DMOZ_UNICODE ifdef MOZ_ENABLE_D3D9_LAYER DEFINES += -DMOZ_ENABLE_D3D9_LAYER diff --git a/widget/xpwidgets/Makefile.in b/widget/xpwidgets/Makefile.in index e149a004f664..fd1785a9e4d3 100644 --- a/widget/xpwidgets/Makefile.in +++ b/widget/xpwidgets/Makefile.in @@ -14,10 +14,6 @@ LIBRARY_NAME = xpwidgets_s MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 -DEFINES += \ - -D_IMPL_NS_WIDGET \ - $(NULL) - SHARED_LIBRARY_LIBS = ../shared/$(LIB_PREFIX)widget_shared.$(LIB_SUFFIX) ifdef MOZ_X11 SHARED_LIBRARY_LIBS += ../shared/x11/$(LIB_PREFIX)widget_shared_x11.$(LIB_SUFFIX) @@ -48,9 +44,6 @@ LOCAL_INCLUDES += \ -I$(srcdir) \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index 68952121f8e0..20f93139c6ef 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -50,16 +50,11 @@ DISABLED_SDK_HEADERS += \ $(NULL) endif -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_COM - ifdef MOZ_WIDGET_GTK CXXFLAGS += $(TK_CFLAGS) endif diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 72f02e61d188..b52b63330676 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -235,7 +235,7 @@ #define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL #define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL -#ifdef _IMPL_NS_COM +#ifdef IMPL_LIBXUL #define XPCOM_API(type) EXPORT_XPCOM_API(type) #elif defined(XPCOM_GLUE) #define XPCOM_API(type) GLUE_XPCOM_API(type) diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in index 5deaf3ae3f73..0cd265c90264 100644 --- a/xpcom/build/Makefile.in +++ b/xpcom/build/Makefile.in @@ -75,10 +75,7 @@ include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk DEFINES += \ - -D_IMPL_NS_COM \ -D_IMPL_NS_STRINGAPI \ - -DEXPORT_XPT_API \ - -DEXPORT_XPTC_API \ -DOMNIJAR_NAME="$(OMNIJAR_NAME)" \ $(NULL) diff --git a/xpcom/build/xrecore.h b/xpcom/build/xrecore.h index ae9324ca0d32..e0bdb597055a 100644 --- a/xpcom/build/xrecore.h +++ b/xpcom/build/xrecore.h @@ -14,7 +14,7 @@ #define XRE_API(type, name, params) \ typedef type (NS_FROZENCALL * name##Type) params; \ extern name##Type name NS_HIDDEN; -#elif defined(IMPL_XREAPI) +#elif defined(IMPL_LIBXUL) #define XRE_API(type, name, params) EXPORT_XPCOM_API(type) name params; #else #define XRE_API(type, name, params) IMPORT_XPCOM_API(type) name params; diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in index 99bf4fad2288..bc813c2fd634 100644 --- a/xpcom/components/Makefile.in +++ b/xpcom/components/Makefile.in @@ -24,13 +24,8 @@ LOCAL_INCLUDES = \ -I$(topsrcdir)/modules/libjar \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_COM - ifdef MOZ_WIDGET_GTK CXXFLAGS += $(TK_CFLAGS) endif diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 230260291937..fd86a5b7443d 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -68,7 +68,7 @@ #include "nsStringEnumerator.h" #include "mozilla/FileUtils.h" -#include NEW_H // for placement new +#include // for placement new #include "mozilla/Omnijar.h" diff --git a/xpcom/ds/Makefile.in b/xpcom/ds/Makefile.in index e7223dadc3bf..637368ad17c3 100644 --- a/xpcom/ds/Makefile.in +++ b/xpcom/ds/Makefile.in @@ -19,12 +19,8 @@ EXTRA_COMPONENTS = \ nsINIProcessor.manifest \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += -I$(srcdir)/../io -DEFINES += -D_IMPL_NS_COM diff --git a/xpcom/ds/nsCppSharedAllocator.h b/xpcom/ds/nsCppSharedAllocator.h index 5e0fc2b74512..275d724d7665 100644 --- a/xpcom/ds/nsCppSharedAllocator.h +++ b/xpcom/ds/nsCppSharedAllocator.h @@ -6,7 +6,7 @@ #define nsCppSharedAllocator_h__ #include "nsMemory.h" // for |nsMemory| -#include NEW_H // to allow placement |new| +#include // to allow placement |new| // under MSVC shut off copious warnings about unused in-lines diff --git a/xpcom/ds/nsWindowsRegKey.h b/xpcom/ds/nsWindowsRegKey.h index def9c3b91a66..a3f4ced961ed 100644 --- a/xpcom/ds/nsWindowsRegKey.h +++ b/xpcom/ds/nsWindowsRegKey.h @@ -26,7 +26,7 @@ NS_NewWindowsRegKey(nsIWindowsRegKey **result); //----------------------------------------------------------------------------- -#ifdef _IMPL_NS_COM +#ifdef IMPL_LIBXUL // a53bc624-d577-4839-b8ec-bb5040a52ff4 #define NS_WINDOWSREGKEY_CID \ @@ -36,7 +36,7 @@ NS_NewWindowsRegKey(nsIWindowsRegKey **result); extern nsresult nsWindowsRegKeyConstructor(nsISupports *outer, const nsIID &iid, void **result); -#endif // _IMPL_NS_COM +#endif // IMPL_LIBXUL //----------------------------------------------------------------------------- diff --git a/xpcom/glue/nsHashKeys.h b/xpcom/glue/nsHashKeys.h index c78477cfbffc..4ef98d506ba9 100644 --- a/xpcom/glue/nsHashKeys.h +++ b/xpcom/glue/nsHashKeys.h @@ -12,7 +12,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "pldhash.h" -#include NEW_H +#include #include "nsStringGlue.h" #include "nsCRTGlue.h" diff --git a/xpcom/glue/nsIClassInfoImpl.h b/xpcom/glue/nsIClassInfoImpl.h index 87c82300b10c..8eee263d6fd4 100644 --- a/xpcom/glue/nsIClassInfoImpl.h +++ b/xpcom/glue/nsIClassInfoImpl.h @@ -8,7 +8,7 @@ #include "nsIClassInfo.h" #include "nsISupportsImpl.h" -#include NEW_H +#include /** * This header file provides macros which help you make your class implement diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 56a47b9a5fd3..06a6ae64f3aa 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -21,7 +21,7 @@ #include "nsQuickSort.h" #include "nsDebug.h" #include "nsTraceRefcnt.h" -#include NEW_H +#include namespace JS { template diff --git a/xpcom/glue/nsTHashtable.h b/xpcom/glue/nsTHashtable.h index 53fb8167d2d7..fb7b50a8c632 100644 --- a/xpcom/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -9,7 +9,7 @@ #include "nscore.h" #include "pldhash.h" #include "nsDebug.h" -#include NEW_H +#include #include "mozilla/MemoryReporting.h" #include "mozilla/fallible.h" diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in index ab6895bc753a..3b7ab12e4729 100644 --- a/xpcom/io/Makefile.in +++ b/xpcom/io/Makefile.in @@ -27,15 +27,10 @@ DISABLED_SDK_HEADERS = \ nsDirectoryServiceUtils.h \ $(NULL) -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk -DEFINES += -D_IMPL_NS_COM - ifeq ($(OS_ARCH),Linux) ifneq (,$(findstring lib64,$(libdir))) DEFINES += -DHAVE_USR_LIB64_DIR diff --git a/xpcom/reflect/xptcall/src/Makefile.in b/xpcom/reflect/xptcall/src/Makefile.in index 80227391cb3d..510cbdbb7e54 100644 --- a/xpcom/reflect/xptcall/src/Makefile.in +++ b/xpcom/reflect/xptcall/src/Makefile.in @@ -19,6 +19,6 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM +DEFINES += -DIMPL_LIBXUL LOCAL_INCLUDES += -I$(srcdir)/../../xptinfo/src diff --git a/xpcom/reflect/xptcall/src/md/os2/Makefile.in b/xpcom/reflect/xptcall/src/md/os2/Makefile.in index 4af5766d07a0..2c672b6c716b 100644 --- a/xpcom/reflect/xptcall/src/md/os2/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/os2/Makefile.in @@ -28,6 +28,6 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPTC_API +DEFINES += -DIMPL_LIBXUL LOCAL_INCLUDES += -I$(srcdir)/../.. diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index 6290bdc687dc..a21c05819dd7 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -277,7 +277,7 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM +DEFINES += -DIMPL_LIBXUL LOCAL_INCLUDES += \ -I$(srcdir)/../.. \ diff --git a/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/xpcom/reflect/xptcall/src/md/win32/Makefile.in index 4e8107668686..17274d1093de 100644 --- a/xpcom/reflect/xptcall/src/md/win32/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/win32/Makefile.in @@ -31,6 +31,6 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM +DEFINES += -DIMPL_LIBXUL LOCAL_INCLUDES += -I$(srcdir)/../.. diff --git a/xpcom/reflect/xptinfo/src/Makefile.in b/xpcom/reflect/xptinfo/src/Makefile.in index 736f1aec62bb..671ceaeef977 100644 --- a/xpcom/reflect/xptinfo/src/Makefile.in +++ b/xpcom/reflect/xptinfo/src/Makefile.in @@ -22,4 +22,4 @@ include $(topsrcdir)/config/rules.mk # For nsManifestLineReader class. LOCAL_INCLUDES = -I$(srcdir)/../../../ds -DEFINES += -DEXPORT_XPT_API -D_IMPL_NS_COM +DEFINES += -DIMPL_LIBXUL diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h index dc7b16d7bae0..ecd71afbf5f5 100644 --- a/xpcom/reflect/xptinfo/src/xptiprivate.h +++ b/xpcom/reflect/xptinfo/src/xptiprivate.h @@ -9,7 +9,7 @@ #define xptiprivate_h___ #include "nscore.h" -#include NEW_H +#include #include "nsISupports.h" // this after nsISupports, to pick up IID diff --git a/xpcom/string/public/nsString.h b/xpcom/string/public/nsString.h index b0e9e8ff0516..838c49c152c4 100644 --- a/xpcom/string/public/nsString.h +++ b/xpcom/string/public/nsString.h @@ -21,7 +21,7 @@ #include "nsReadableUtils.h" #endif -#include NEW_H +#include // enable support for the obsolete string API if not explicitly disabled #ifndef MOZ_STRING_WITH_OBSOLETE_API diff --git a/xpcom/string/src/Makefile.in b/xpcom/string/src/Makefile.in index 701f18184290..2b6af773628b 100644 --- a/xpcom/string/src/Makefile.in +++ b/xpcom/string/src/Makefile.in @@ -32,4 +32,4 @@ nsUTF8UtilsSSE2.$(OBJ_SUFFIX): CXXFLAGS+=-xarch=sse2 -xO4 endif endif -DEFINES += -D_IMPL_NS_COM +DEFINES += -DIMPL_LIBXUL diff --git a/xpcom/threads/Makefile.in b/xpcom/threads/Makefile.in index b57c3cb361e5..095ce6e04669 100644 --- a/xpcom/threads/Makefile.in +++ b/xpcom/threads/Makefile.in @@ -17,11 +17,6 @@ LIBXUL_LIBRARY = 1 LOCAL_INCLUDES = -I$(srcdir)/../components LOCAL_INCLUDES = -I$(srcdir)/../build -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_COM - diff --git a/xpcom/typelib/xpt/src/Makefile.in b/xpcom/typelib/xpt/src/Makefile.in index 3f446a5ea39f..4316fec89dd8 100644 --- a/xpcom/typelib/xpt/src/Makefile.in +++ b/xpcom/typelib/xpt/src/Makefile.in @@ -25,7 +25,7 @@ NO_PROFILE_GUIDED_OPTIMIZE = 1 include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPT_API +DEFINES += -DIMPL_LIBXUL # Build libxpt early so that it'll be available to xpidl, which also # must be built early. diff --git a/xpcom/typelib/xpt/tests/Makefile.in b/xpcom/typelib/xpt/tests/Makefile.in index a8206746cd58..d728e5b57846 100644 --- a/xpcom/typelib/xpt/tests/Makefile.in +++ b/xpcom/typelib/xpt/tests/Makefile.in @@ -20,4 +20,4 @@ LIBS = \ include $(topsrcdir)/config/rules.mk -DEFINES += -DEXPORT_XPT_API +DEFINES += -DIMPL_LIBXUL diff --git a/xpcom/xpcom-config.h.in b/xpcom/xpcom-config.h.in index 5b18eba9c6c6..58c8dd85be78 100644 --- a/xpcom/xpcom-config.h.in +++ b/xpcom/xpcom-config.h.in @@ -34,9 +34,6 @@ */ #undef NEED_CPP_UNUSED_IMPLEMENTATIONS -/* Define to either or */ -#undef NEW_H - /* Define to either __attribute__((malloc)) or nothing */ #undef NS_ATTR_MALLOC diff --git a/xpfe/components/directory/Makefile.in b/xpfe/components/directory/Makefile.in index 73d767e12767..fd7e82c17af4 100644 --- a/xpfe/components/directory/Makefile.in +++ b/xpfe/components/directory/Makefile.in @@ -12,9 +12,5 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - include $(topsrcdir)/config/rules.mk diff --git a/xulrunner/app/xulrunner.exe.manifest b/xulrunner/app/xulrunner.exe.manifest index 9d5f04c07363..6147520c2ceb 100644 --- a/xulrunner/app/xulrunner.exe.manifest +++ b/xulrunner/app/xulrunner.exe.manifest @@ -28,7 +28,10 @@ - + + + + diff --git a/xulrunner/stub/xulrunner-stub.exe.manifest b/xulrunner/stub/xulrunner-stub.exe.manifest index 8ffb204dadbc..536c8871b756 100644 --- a/xulrunner/stub/xulrunner-stub.exe.manifest +++ b/xulrunner/stub/xulrunner-stub.exe.manifest @@ -28,7 +28,10 @@ - + + + +