mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Merge m-c to birch.
This commit is contained in:
commit
ae807eef57
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 += \
|
||||
|
@ -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 = \
|
||||
|
@ -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 = \
|
||||
|
@ -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'],
|
||||
|
@ -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,
|
||||
|
@ -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]),
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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 += \
|
||||
|
@ -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 += \
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 = \
|
||||
|
66
addon-sdk/source/bin/activate.fish
Normal file
66
addon-sdk/source/bin/activate.fish
Normal file
@ -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()"
|
@ -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
|
||||
|
||||
|
@ -1,259 +0,0 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
The `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.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="55%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
<th>Example non-matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"http://example.com/"</code></td>
|
||||
<td><code>http://example.com/</code></td>
|
||||
<td><code>http://example.com</code><br>
|
||||
<code>http://example.com/foo</code><br>
|
||||
<code>https://example.com/</code><br>
|
||||
<code>http://foo.example.com/</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
### 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.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="55%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
<th>Example non-matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"*"</code></td>
|
||||
<td><code>http://example.com/</code><br>
|
||||
<code>https://example.com/</code><br>
|
||||
<code>ftp://example.com/</code><br>
|
||||
<code>http://bar.com/foo.js</code><br>
|
||||
<code>http://foo.com/</code></td>
|
||||
<td><code>file://example.js</code><br>
|
||||
<code>resource://me/my-addon/data/file.html</code><br>
|
||||
<code>data:text/html,Hi there</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
**A domain name prefixed with an asterisk and dot** matches any URL of that
|
||||
domain or a subdomain, using any of `http`, `https`, `ftp`.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="55%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
<th>Example non-matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"*.example.com"</code></td>
|
||||
<td><code>http://example.com/</code><br>
|
||||
<code>http://foo.example.com/</code><br>
|
||||
<code>https://example.com/</code><br>
|
||||
<code>http://example.com/foo</code><br>
|
||||
<code>ftp://foo.example.com/</code></td>
|
||||
<td><code>ldap://example.com</code><br>
|
||||
<code>http://example.foo.com/</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
**A URL followed by an asterisk** matches that URL and any URL prefixed with
|
||||
the pattern.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="55%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
<th>Example non-matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"https://foo.com/*"</code></td>
|
||||
<td><code>https://foo.com/</code><br>
|
||||
<code>https://foo.com/bar</code></td>
|
||||
<td><code>http://foo.com/</code><br>
|
||||
<code>https://foo.com</code><br>
|
||||
<code>https://bar.foo.com/</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
**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://`.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="80%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"file://*"</code></td>
|
||||
<td><code>file://C:/file.html</code><br>
|
||||
<code>file:///home/file.png</code></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"resource://*"</code></td>
|
||||
<td><code>resource://my-addon-at-me-dot-org/my-addon/data/file.html</code></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>"data:*"</code></td>
|
||||
<td><code>data:text/html,Hi there</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
### 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.
|
||||
|
||||
<table>
|
||||
|
||||
<colgroup>
|
||||
<col width="30%">
|
||||
<col width="35%">
|
||||
<col width="35%">
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<th>Example pattern</th>
|
||||
<th>Example matching URLs</th>
|
||||
<th>Example non-matching URLs</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>/.*moz.*/</code></td>
|
||||
<td><code>http://foo.mozilla.org/</code><br>
|
||||
<code>http://mozilla.org</code><br>
|
||||
<code>https://mozilla.org</code><br>
|
||||
<code>http://foo.com/mozilla</code><br>
|
||||
<code>http://hemozoon.org</code><br>
|
||||
<code>mozscheme://foo.org</code><br></td>
|
||||
<td><code>http://foo.org</code><br>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>/http:\/\/moz.*/</code></td>
|
||||
<td><code>http://mozilla.org</code><br>
|
||||
<code>http://mozzarella.com</code></td>
|
||||
<td><code>https://mozilla.org</code><br>
|
||||
<code>http://foo.mozilla.org/</code><br>
|
||||
<code>http://foo.com/moz</code></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>/http.*moz.*/</code><br></td>
|
||||
<td><code>http://foo.mozilla.org/</code><br>
|
||||
<code>http://mozilla.org</code><br>
|
||||
<code>http://hemozoon.org/</code></td>
|
||||
<td><code>ftp://http/mozilla.org</code></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
## 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!
|
||||
|
||||
<api name="MatchPattern">
|
||||
@class
|
||||
<api name="MatchPattern">
|
||||
@constructor
|
||||
This constructor creates match pattern objects that can be used to test URLs.
|
||||
@param pattern {string}
|
||||
The pattern to use. See Patterns above.
|
||||
</api>
|
||||
|
||||
<api name="test">
|
||||
@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.
|
||||
</api>
|
||||
</api>
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
@ -5,7 +5,10 @@
|
||||
"use strict";
|
||||
|
||||
module.metadata = {
|
||||
"stability": "unstable"
|
||||
"stability": "unstable",
|
||||
"engines": {
|
||||
"Firefox": "*"
|
||||
}
|
||||
};
|
||||
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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,<html><head><title>foo</title></head><body>foo</body></html>";
|
||||
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
|
||||
|
@ -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");
|
||||
});
|
||||
|
@ -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);
|
||||
|
@ -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 = [];
|
||||
|
@ -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)));
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 = "<html>\
|
||||
<body>\
|
||||
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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)();
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -33,7 +33,10 @@
|
||||
</ms_asmv3:application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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!");
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"clang_version": "r170890"
|
||||
"clang_version": "r185949"
|
||||
},
|
||||
{
|
||||
"filename": "setup.sh",
|
||||
"algorithm": "sha512",
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"size": 47
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"filename": "clang.tar.bz2",
|
||||
"size": 72573411,
|
||||
"digest": "491753968f34d1bd3c58280688349499a92f31a118eb6f28e86746be62615004370394b8e1b10d48dc3fba4bc6d4fbb4ce6c7dbc4fadb39447de9aa55573c58e",
|
||||
"algorithm": "sha512",
|
||||
"digest": "0bcfc19f05cc0f042befb3823c7ecce9ba411b152921aa29e97e7adc846e0258fd7da521b1620cb1e61a19d2fcac9b60e6d613c922b6c153e01b9b0766651d09",
|
||||
"size": 62708281
|
||||
"filename": "clang.tar.bz2"
|
||||
}
|
||||
]
|
||||
|
@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"clang_version": "r170890"
|
||||
},
|
||||
"clang_version": "r185949"
|
||||
},
|
||||
{
|
||||
"filename": "setup.sh",
|
||||
"algorithm": "sha512",
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"size": 47
|
||||
},
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"filename": "clang.tar.bz2",
|
||||
"algorithm": "sha512",
|
||||
"digest": "e14ccefd965372a57c540647b2b99e21a4aa82f81a8b9a9e18dac7cba4c3436181bef0dfab8c51bcb5c343f504a693fdcfbe7d609f10291b5dd65ab059979d29",
|
||||
"size": 63034761
|
||||
"size": 73050713,
|
||||
"digest": "2c5c26a44402f974c2a4ccffb07ea1ac2d01d84dc3e4281fef6e047a62606811a16534d034477dfd9be055a07d931b17ca4e883c8edcd1f8d3a8c91b150e2288",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
}
|
||||
]
|
||||
|
@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"clang_version": "r170890"
|
||||
},
|
||||
"clang_version": "r185949"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
},
|
||||
{
|
||||
"size": 56126352,
|
||||
"digest": "e156e2a39abd5bf272ee30748a6825f22ddd27565b097c66662a2a6f2e9892bc5b4bf30a3552dffbe867dbfc39e7ee086e0b2cd7935f6ea216c0cf936178a88f",
|
||||
"algorithm": "sha512",
|
||||
"size": 61779086,
|
||||
"digest": "b2f2861da7583e859b4fb40e1304dd284df02466c909893684341b16e2f58c4c100891504938cf62f26ac82254b9e87135ba98f8196dd26e9b58d3242f1cf811",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
}
|
||||
]
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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@;
|
||||
|
@ -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
|
||||
|
11
build/unix/build-clang/clang-trunk.json
Normal file
11
build/unix/build-clang/clang-trunk.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"llvm_revision": "185949",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/trunk",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
|
||||
"patches": {
|
||||
"macosx64": ["llvm-debug-frame.patch"],
|
||||
"linux64": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"],
|
||||
"linux32": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"]
|
||||
}
|
||||
}
|
@ -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 @@ private:
|
||||
case REL(ARM, REL32):
|
||||
apply_relocation<pc32_relocation>(the_code, buf, &*r, addr);
|
||||
break;
|
||||
case REL(ARM, JUMP24):
|
||||
case REL(ARM, PLT32):
|
||||
apply_relocation<arm_plt32_relocation>(the_code, buf, &*r, addr);
|
||||
break;
|
||||
|
@ -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
|
||||
|
@ -11,7 +11,6 @@ VPATH = @srcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MSVC_ENABLE_PGO := 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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::
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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: autotargets.mk>
|
||||
|
||||
|
||||
###########################################################################
|
||||
# <CHECK: export-targets.mk>
|
||||
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) $@
|
||||
# </CHECK: export-targets.mk>
|
||||
|
||||
endif #} findstring MAKECMDGOAL
|
||||
|
@ -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)
|
||||
|
||||
|
||||
# <CHECK: final-lib-link-list>
|
||||
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)
|
||||
# </CHECK: final-lib-link-list>
|
||||
|
||||
|
||||
include $(topsrcdir)/config/makefiles/target_export.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
|
||||
|
||||
###########################################################################
|
||||
|
49
configure.in
49
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, <new>)
|
||||
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. <new>) 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
|
||||
|
@ -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 @@ public:
|
||||
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
|
||||
|
@ -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,
|
||||
|
@ -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<XBLChildrenElement*>(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-<children>, or a <children> with content.
|
||||
while (mChild &&
|
||||
mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
|
||||
while (mChild && mChild->IsActiveChildrenElement()) {
|
||||
XBLChildrenElement* point = static_cast<XBLChildrenElement*>(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-<children>, or a <children> with content.
|
||||
while (mChild &&
|
||||
mChild->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
|
||||
while (mChild && mChild->IsActiveChildrenElement()) {
|
||||
XBLChildrenElement* point = static_cast<XBLChildrenElement*>(mChild);
|
||||
if (!point->mInsertedChildren.IsEmpty()) {
|
||||
mIndexInInserted = point->InsertedChildrenLength();
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
};
|
||||
|
||||
class DocumentType : public DocumentTypeForward
|
||||
class DocumentType MOZ_FINAL : public DocumentTypeForward
|
||||
{
|
||||
public:
|
||||
DocumentType(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -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 \
|
||||
|
@ -1501,7 +1501,7 @@ nsContentSink::IsScriptExecutingImpl()
|
||||
nsresult
|
||||
nsContentSink::WillParseImpl(void)
|
||||
{
|
||||
if (mRunsToCompletion) {
|
||||
if (mRunsToCompletion || !mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -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<nsINodeInfo> aNodeInfo)
|
||||
|
@ -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)) {
|
||||
|
@ -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<JSObject*> 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<nsINode> 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 @@ private:
|
||||
nsCOMPtr<nsIContentIterator> mIter;
|
||||
RangeSubtreeIterState mIterState;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mStart;
|
||||
nsCOMPtr<nsIDOMNode> mEnd;
|
||||
nsCOMPtr<nsINode> mStart;
|
||||
nsCOMPtr<nsINode> mEnd;
|
||||
|
||||
public:
|
||||
|
||||
@ -1436,8 +1424,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
nsresult Init(nsIDOMRange *aRange);
|
||||
already_AddRefed<nsIDOMNode> GetCurrentNode();
|
||||
nsresult Init(nsRange *aRange);
|
||||
already_AddRefed<nsINode> GetCurrentNode();
|
||||
void First();
|
||||
void Last();
|
||||
void Next();
|
||||
@ -1450,54 +1438,37 @@ public:
|
||||
};
|
||||
|
||||
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<nsIDOMNode> 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<nsINode> node = aRange->GetStartContainer(rv);
|
||||
if (!node) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMCharacterData> 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<nsINode> 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<nsIDOMCharacterData> endData = do_QueryInterface(node);
|
||||
if (endData) {
|
||||
if (endData || (node->IsElement() && aRange->GetEndOffset(rv) == 0)) {
|
||||
mEnd = node;
|
||||
} else {
|
||||
int32_t endIndex;
|
||||
aRange->GetEndOffset(&endIndex);
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode>
|
||||
already_AddRefed<nsINode>
|
||||
RangeSubtreeIterator::GetCurrentNode()
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> commonAncestor;
|
||||
res = aRange->GetCommonAncestorContainer(getter_AddRefs(commonAncestor));
|
||||
if(NS_FAILED(res)) return res;
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsINode> commonAncestor = aRange->GetCommonAncestorContainer(rv);
|
||||
if (rv.Failed()) return rv.ErrorCode();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> startContainer, endContainer;
|
||||
|
||||
res = aRange->GetStartContainer(getter_AddRefs(startContainer));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = aRange->GetEndContainer(getter_AddRefs(endContainer));
|
||||
if (NS_FAILED(res)) return res;
|
||||
nsCOMPtr<nsINode> startContainer = aRange->GetStartContainer(rv);
|
||||
if (rv.Failed()) return rv.ErrorCode();
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> nodeToSelect(startContainer), parent;
|
||||
nsCOMPtr<nsINode> nodeToSelect(startContainer);
|
||||
|
||||
while (nodeToSelect)
|
||||
{
|
||||
nsresult res = nodeToSelect->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> first, tmpNode;
|
||||
aParent->GetFirstChild(getter_AddRefs(first));
|
||||
return aParent->InsertBefore(aChild, first, getter_AddRefs(tmpNode));
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> domNode = aIter.GetCurrentNode();
|
||||
if (!domNode) {
|
||||
nsCOMPtr<nsINode> 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<nsINode> 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<nsIDocument> doc = mStartParent->OwnerDoc();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> commonAncestor;
|
||||
nsresult rv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult res;
|
||||
nsCOMPtr<nsINode> commonAncestor = GetCommonAncestorContainer(res);
|
||||
NS_ENSURE_SUCCESS(res.ErrorCode(), res.ErrorCode());
|
||||
|
||||
// If aFragment isn't null, create a temporary fragment to hold our return.
|
||||
nsRefPtr<dom::DocumentFragment> retval;
|
||||
nsRefPtr<DocumentFragment> retval;
|
||||
if (aFragment) {
|
||||
retval = new dom::DocumentFragment(doc->NodeInfoManager());
|
||||
retval = new DocumentFragment(doc->NodeInfoManager());
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> commonCloneAncestor = retval.get();
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> startContainer = do_QueryInterface(mStartParent);
|
||||
nsCOMPtr<nsINode> startContainer = mStartParent;
|
||||
int32_t startOffset = mStartOffset;
|
||||
nsCOMPtr<nsIDOMNode> endContainer = do_QueryInterface(mEndParent);
|
||||
nsCOMPtr<nsINode> 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<nsIDOMDocument> commonAncestorDocument(do_QueryInterface(commonAncestor));
|
||||
nsCOMPtr<nsIDocument> commonAncestorDocument = do_QueryInterface(commonAncestor);
|
||||
if (commonAncestorDocument) {
|
||||
nsCOMPtr<nsIDOMDocumentType> doctype;
|
||||
rv = commonAncestorDocument->GetDoctype(getter_AddRefs(doctype));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsRefPtr<DocumentType> 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<nsIDOMNode> nodeToResult;
|
||||
nsCOMPtr<nsIDOMNode> node(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> nodeToResult;
|
||||
nsCOMPtr<nsINode> 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<nsINode> 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<nsIDOMNode> 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<nsIDOMNode> tmpNode;
|
||||
// Set the result to document fragment if we have 'retval'.
|
||||
if (retval) {
|
||||
nsCOMPtr<nsIDOMNode> oldCommonAncestor = commonAncestor;
|
||||
nsCOMPtr<nsINode> oldCommonAncestor = commonAncestor;
|
||||
if (!iter.IsDone()) {
|
||||
// Setup the parameters for the next iteration of the loop.
|
||||
nsCOMPtr<nsIDOMNode> prevNode(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> parentCounterNode = node;
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> closestAncestor, farthestAncestor;
|
||||
nsCOMPtr<nsINode> 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<nsINode> n = do_QueryInterface(commonCloneAncestor);
|
||||
rv = PrependChild(n, farthestAncestor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsMutationGuard guard;
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nodeToResult->GetParentNode(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsINode> 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<nsINode> node = do_QueryInterface(nodeToResult);
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> newCloneAncestor = nodeToResult;
|
||||
nsCOMPtr<nsINode> 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<dom::DocumentFragment> fragment;
|
||||
nsRefPtr<DocumentFragment> fragment;
|
||||
nsresult rv = CutContents(getter_AddRefs(fragment));
|
||||
fragment.forget(aReturn);
|
||||
return rv;
|
||||
}
|
||||
|
||||
already_AddRefed<dom::DocumentFragment>
|
||||
already_AddRefed<DocumentFragment>
|
||||
nsRange::ExtractContents(ErrorResult& rv)
|
||||
{
|
||||
nsRefPtr<dom::DocumentFragment> fragment;
|
||||
nsRefPtr<DocumentFragment> 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<nsIDOMNode> parent, firstParent, lastParent;
|
||||
|
||||
nsresult res = aNode->GetParentNode(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsINode> firstParent, lastParent;
|
||||
nsCOMPtr<nsINode> parent = aNode->GetParentNode();
|
||||
|
||||
while(parent && parent != aAncestor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> clone, tmpNode;
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsINode> clone = parent->CloneNode(false, rv);
|
||||
|
||||
res = parent->CloneNode(false, 1, getter_AddRefs(clone));
|
||||
if (rv.Failed()) {
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
if (!clone) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(res)) return res;
|
||||
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<dom::DocumentFragment>
|
||||
already_AddRefed<DocumentFragment>
|
||||
nsRange::CloneContents(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> commonAncestor;
|
||||
aRv = GetCommonAncestorContainer(getter_AddRefs(commonAncestor));
|
||||
nsCOMPtr<nsINode> commonAncestor = GetCommonAncestorContainer(aRv);
|
||||
MOZ_ASSERT(!aRv.Failed(), "GetCommonAncestorContainer() shouldn't fail!");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document =
|
||||
do_QueryInterface(mStartParent->OwnerDoc());
|
||||
NS_ASSERTION(document, "CloneContents needs a document to continue.");
|
||||
if (!document) {
|
||||
nsCOMPtr<nsIDocument> 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<nsIDocument> doc(do_QueryInterface(document));
|
||||
nsRefPtr<DocumentFragment> clonedFrag =
|
||||
new DocumentFragment(doc->NodeInfoManager());
|
||||
|
||||
nsRefPtr<dom::DocumentFragment> clonedFrag =
|
||||
new dom::DocumentFragment(doc->NodeInfoManager());
|
||||
|
||||
nsCOMPtr<nsIDOMNode> commonCloneAncestor = clonedFrag.get();
|
||||
if (!commonCloneAncestor) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> node(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> iNode = do_QueryInterface(node);
|
||||
bool deepClone = !iNode->IsElement() ||
|
||||
(!(iNode == mEndParent && mEndOffset == 0) &&
|
||||
!(iNode == mStartParent &&
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> clone;
|
||||
aRv = node->CloneNode(deepClone, 1, getter_AddRefs(clone));
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> closestAncestor, farthestAncestor;
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> 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<nsINode> 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<nsIDOMNode> nextNode(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> tStartContainer;
|
||||
aRv = this->GetStartContainer(getter_AddRefs(tStartContainer));
|
||||
nsCOMPtr<nsINode> tStartContainer = GetStartContainer(aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This is the node we'll be inserting before, and its parent
|
||||
nsCOMPtr<nsIDOMNode> referenceNode;
|
||||
nsCOMPtr<nsIDOMNode> referenceParentNode = tStartContainer;
|
||||
nsCOMPtr<nsINode> referenceNode;
|
||||
nsCOMPtr<nsINode> referenceParentNode = tStartContainer;
|
||||
|
||||
nsCOMPtr<nsIDOMText> startTextNode(do_QueryInterface(tStartContainer));
|
||||
nsCOMPtr<nsIDOMNodeList> 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<nsIDOMNode> 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<nsIDOMNode> tResultNode;
|
||||
nsCOMPtr<nsIDOMNode> node = aNode.AsDOMNode();
|
||||
if (!node) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_OBJECT_ERR);
|
||||
return;
|
||||
}
|
||||
aRv = referenceParentNode->InsertBefore(node, referenceNode, getter_AddRefs(tResultNode));
|
||||
nsCOMPtr<nsINode> 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<nsIDOMDocumentFragment> docFrag;
|
||||
|
||||
aRv = ExtractContents(getter_AddRefs(docFrag));
|
||||
nsRefPtr<DocumentFragment> docFrag = ExtractContents(aRv);
|
||||
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
@ -2657,8 +2580,6 @@ nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv)
|
||||
|
||||
uint32_t numChildren = children->Length();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> tmpNode;
|
||||
|
||||
while (numChildren)
|
||||
{
|
||||
nsCOMPtr<nsINode> 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<nsIDOMText> 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<nsIContentIterator> 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<dom::DocumentFragment>
|
||||
already_AddRefed<DocumentFragment>
|
||||
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<nsIDOMNode> startContainer = do_QueryInterface(aStartParent);
|
||||
nsCOMPtr<nsIDOMNode> endContainer = do_QueryInterface(aEndParent);
|
||||
nsCOMPtr<nsINode> startContainer = aStartParent;
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> node(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> node = iter.GetCurrentNode();
|
||||
iter.Next();
|
||||
nsCOMPtr<nsIContent> 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<nsIDOMNode> startContainer = do_QueryInterface(mStartParent);
|
||||
nsCOMPtr<nsIDOMNode> endContainer = do_QueryInterface(mEndParent);
|
||||
nsCOMPtr<nsINode> startContainer = do_QueryInterface(mStartParent);
|
||||
nsCOMPtr<nsINode> 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<nsIDOMNode> node(iter.GetCurrentNode());
|
||||
nsCOMPtr<nsINode> node = iter.GetCurrentNode();
|
||||
iter.Next();
|
||||
|
||||
nsCOMPtr<nsIContent> 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>
|
||||
nsRange::Constructor(const dom::GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
nsRange::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
|
||||
if (!window || !window->GetDoc()) {
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
class nsClientRect;
|
||||
class nsClientRectList;
|
||||
class nsIDOMDocumentFragment;
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
@ -89,7 +88,7 @@ public:
|
||||
|
||||
// nsIDOMRange interface
|
||||
NS_DECL_NSIDOMRANGE
|
||||
|
||||
|
||||
nsINode* GetRoot() const
|
||||
{
|
||||
return mRoot;
|
||||
@ -235,16 +234,16 @@ private:
|
||||
*/
|
||||
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!
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -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
|
||||
|
@ -38,6 +38,10 @@
|
||||
testStatic("xhtml3", "Test", "XHTML <title> 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);
|
||||
});
|
||||
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);
|
||||
} ] ];
|
||||
|
||||
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);
|
||||
});
|
||||
var titleWindow = window;
|
||||
|
||||
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);
|
||||
});
|
||||
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];
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
function end() {
|
||||
for (description in inProgress) {
|
||||
ok(!inProgress[description],
|
||||
description + ": DOMTitleChange not fired");
|
||||
testDynamic(testElementId, testExpectedValue, testDescription,
|
||||
spinEventLoopOp, testCheckDOM);
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
SimpleTest.executeSoon(end);
|
||||
|
||||
window.setTimeout(runIndividualTest, 0, 0);
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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']
|
||||
|
18
content/canvas/test/webgl/non-conf-tests/Makefile.in
Normal file
18
content/canvas/test/webgl/non-conf-tests/Makefile.in
Normal file
@ -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
|
5
content/canvas/test/webgl/non-conf-tests/moz.build
Normal file
5
content/canvas/test/webgl/non-conf-tests/moz.build
Normal file
@ -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/.
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>WebGL test: 'webgl' context request</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c"></canvas>
|
||||
<script>
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var gl = canvas.getContext('webgl');
|
||||
|
||||
var isMobile = /Mobile/.test(navigator.userAgent);
|
||||
var isTablet = /Tablet/.test(navigator.userAgent);
|
||||
var shouldBeConformant = !isMobile && !isTablet;
|
||||
|
||||
if (shouldBeConformant) {
|
||||
// Desktop.
|
||||
ok(gl, 'Expected conformance on: ' + navigator.userAgent);
|
||||
} else {
|
||||
// Fennec, B2G.
|
||||
ok(!gl, 'Expected no conformance on: ' + navigator.userAgent);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -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
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsError.h"
|
||||
#include "nsMutationEvent.h"
|
||||
#include NEW_H
|
||||
#include <new>
|
||||
#include "nsINode.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsFrameLoader.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<nsINodeInfo> aNodeInfo);
|
||||
|
@ -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<nsINodeInfo> aNodeInfo);
|
||||
|
@ -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;
|
||||
|
@ -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<nsINodeInfo> aNodeInfo);
|
||||
|
@ -33,8 +33,8 @@ public:
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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<nsINodeInfo> aNodeInfo)
|
||||
|
@ -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<nsINodeInfo> aNodeInfo);
|
||||
|
@ -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;
|
||||
|
@ -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<nsINodeInfo> aNodeInfo)
|
||||
|
@ -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;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user