Merge the last green changeset on mozilla-inbound to mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-07-22 15:48:18 -04:00
commit 3be0b6110e
123 changed files with 68674 additions and 3130 deletions

View File

@ -117,7 +117,6 @@ static gint sListener_idx = 1;
static GHashTable* sKey_listener_list = NULL;
static guint sKey_snooper_id = 0;
static GQuark sQuark_gecko_acc_obj = g_quark_from_static_string("GeckoAccObj");
static bool sToplevel_event_hook_added = false;
static gulong sToplevel_show_hook = 0;
static gulong sToplevel_hide_hook = 0;
@ -570,6 +569,11 @@ toplevel_event_watcher(GSignalInvocationHint* ihint,
const GValue* param_values,
gpointer data)
{
static GQuark sQuark_gecko_acc_obj = 0;
if (!sQuark_gecko_acc_obj)
sQuark_gecko_acc_obj = g_quark_from_static_string("GeckoAccObj");
if (nsAccessibilityService::IsShutdown())
return TRUE;

View File

@ -206,6 +206,19 @@ private:
printf("document type: [failed]"); \
}
#define NS_LOG_ACCDOC_DOCSHELLTREE(aDocument) \
if (aDocument->IsActive()) { \
nsCOMPtr<nsISupports> container = aDocument->GetContainer(); \
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container)); \
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem; \
treeItem->GetParent(getter_AddRefs(parentTreeItem)); \
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem; \
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem)); \
printf("docshell hierarchy, parent: %p, root: %p, is tab document: %s;", \
parentTreeItem, rootTreeItem, \
(nsCoreUtils::IsTabDocument(aDocument) ? "yes" : "no")); \
}
#define NS_LOG_ACCDOC_SHELLSTATE(aDocument) \
nsCAutoString docShellBusy; \
nsCOMPtr<nsISupports> container = aDocument->GetContainer(); \
@ -352,6 +365,8 @@ private:
printf("; "); \
NS_LOG_ACCDOC_TYPE(aDocument) \
printf("\n "); \
NS_LOG_ACCDOC_DOCSHELLTREE(aDocument) \
printf("\n "); \
NS_LOG_ACCDOC_DOCSTATES(aDocument) \
printf("\n "); \
NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \

View File

@ -480,6 +480,26 @@ nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
return (contentType == nsIDocShellTreeItem::typeContent);
}
bool
nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
{
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
treeItem->GetParent(getter_AddRefs(parentTreeItem));
// Tab document running in own process doesn't have parent.
if (XRE_GetProcessType() == GeckoProcessType_Content)
return !parentTreeItem;
// Parent of docshell for tab document running in chrome process is root.
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
return parentTreeItem == rootTreeItem;
}
PRBool
nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
{

View File

@ -233,6 +233,11 @@ public:
*/
static PRBool IsContentDocument(nsIDocument *aDocument);
/**
* Return true if the given document node is for tab document accessible.
*/
static bool IsTabDocument(nsIDocument* aDocumentNode);
/**
* Return true if the given document is an error page.
*/

View File

@ -107,6 +107,8 @@ EXPORTS = \
# 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
LOCAL_INCLUDES += \
@ -114,5 +116,6 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../base \
-I$(srcdir)/../html \
-I$(srcdir)/../xul \
-I$(srcdir)/../../../content/base/src \
-I$(srcdir)/../../../content/events/src \
$(NULL)

View File

@ -204,7 +204,7 @@ __try {
// accessibles.
if (!doc->ParentDocument() ||
nsWinUtils::IsWindowEmulationStarted() &&
nsWinUtils::IsTabDocument(doc->GetDocumentNode())) {
nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) {
HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
IID_IAccessible,

View File

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/dom/TabChild.h"
#include "nsDocAccessibleWrap.h"
#include "ISimpleDOMDocument_i.c"
#include "nsIAccessibilityService.h"
@ -242,7 +244,7 @@ nsDocAccessibleWrap::Shutdown()
// Do window emulation specific shutdown if emulation was started.
if (nsWinUtils::IsWindowEmulationStarted()) {
// Destroy window created for root document.
if (nsWinUtils::IsTabDocument(mDocument)) {
if (nsCoreUtils::IsTabDocument(mDocument)) {
sHWNDCache.Remove(mHWND);
::DestroyWindow(static_cast<HWND>(mHWND));
}
@ -272,9 +274,19 @@ nsDocAccessibleWrap::NotifyOfInitialUpdate()
if (nsWinUtils::IsWindowEmulationStarted()) {
// Create window for tab document.
if (nsWinUtils::IsTabDocument(mDocument)) {
if (nsCoreUtils::IsTabDocument(mDocument)) {
mozilla::dom::TabChild* tabChild =
mozilla::dom::GetTabChildFrom(mDocument->GetShell());
nsRootAccessible* rootDocument = RootAccessible();
mozilla::WindowsHandle nativeData = nsnull;
if (tabChild)
tabChild->SendGetWidgetNativeData(&nativeData);
else
nativeData = reinterpret_cast<mozilla::WindowsHandle>(
rootDocument->GetNativeWindow());
PRBool isActive = PR_TRUE;
PRInt32 x = CW_USEDEFAULT, y = CW_USEDEFAULT, width = 0, height = 0;
if (nsWinUtils::IsWindowEmulationFor(kDolphinModuleHandle)) {
@ -289,7 +301,7 @@ nsDocAccessibleWrap::NotifyOfInitialUpdate()
docShell->GetIsActive(&isActive);
}
HWND parentWnd = static_cast<HWND>(rootDocument->GetNativeWindow());
HWND parentWnd = reinterpret_cast<HWND>(nativeData);
mHWND = nsWinUtils::CreateNativeWindow(kClassNameTabContent, parentWnd,
x, y, width, height, isActive);

View File

@ -64,7 +64,7 @@ void
nsRootAccessibleWrap::DocumentActivated(nsDocAccessible* aDocument)
{
if (nsWinUtils::IsWindowEmulationFor(kDolphinModuleHandle) &&
nsWinUtils::IsTabDocument(aDocument->GetDocumentNode())) {
nsCoreUtils::IsTabDocument(aDocument->GetDocumentNode())) {
PRUint32 count = mChildDocuments.Length();
for (PRUint32 idx = 0; idx < count; idx++) {
nsDocAccessible* childDoc = mChildDocuments[idx];

View File

@ -176,23 +176,10 @@ nsWinUtils::HideNativeWindow(HWND aWnd)
bool
nsWinUtils::IsWindowEmulationFor(LPCWSTR kModuleHandle)
{
// Window emulation is always enabled in multiprocess Firefox.
return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) :
XRE_GetProcessType() == GeckoProcessType_Content ||
::GetModuleHandleW(kJAWSModuleHandle) ||
::GetModuleHandleW(kWEModuleHandle) ||
::GetModuleHandleW(kDolphinModuleHandle);
}
bool
nsWinUtils::IsTabDocument(nsIDocument* aDocumentNode)
{
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
treeItem->GetParent(getter_AddRefs(parentTreeItem));
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
return parentTreeItem == rootTreeItem;
}

View File

@ -104,11 +104,6 @@ public:
* Return true if window emulation is enabled.
*/
static bool IsWindowEmulationFor(LPCWSTR kModuleHandle);
/**
* Return true if the given document node is for tab document accessible.
*/
static bool IsTabDocument(nsIDocument* aDocumentNode);
};
#endif

View File

@ -465,7 +465,7 @@ nsXULMenuitemAccessible::KeyboardShortcut() const
PRUint32 modifierMask = 0;
if (modifiersStr.Find("shift") != -1)
modifierMask != KeyBinding::kShift;
modifierMask |= KeyBinding::kShift;
if (modifiersStr.Find("alt") != -1)
modifierMask |= KeyBinding::kAlt;
if (modifiersStr.Find("meta") != -1)

View File

@ -0,0 +1,93 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org
#
# The Initial Developer of the Original Code is
# the Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Hommey <mh@glandium.org>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# This script returns the number of items for the DW_AT_ranges corresponding
# to a given compilation unit. This is used as a helper to find a bug in some
# versions of GNU ld.
import subprocess
import sys
import re
def get_range_for(compilation_unit, debug_info):
'''Returns the range offset for a given compilation unit
in a given debug_info.'''
name = ranges = ''
search_cu = False
for nfo in debug_info.splitlines():
if 'DW_TAG_compile_unit' in nfo:
search_cu = True
elif 'DW_TAG_' in nfo or not nfo.strip():
if name == compilation_unit:
return int(ranges, 0)
name = ranges = ''
search_cu = False
if search_cu:
if 'DW_AT_name' in nfo:
name = nfo.rsplit(None, 1)[1]
elif 'DW_AT_ranges' in nfo:
ranges = nfo.rsplit(None, 1)[1]
return None
def get_range_length(range, debug_ranges):
'''Returns the number of items in the range starting at the
given offset.'''
length = 0
for line in debug_ranges.splitlines():
m = re.match('\s*([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)', line)
if m and int(m.group(1), 0) == range:
length += 1
return length
def main(bin, compilation_unit):
p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(out, err) = p.communicate()
sections = re.split('\n(Contents of the|The section) ', out)
debug_info = [s for s in sections if s.startswith('.debug_info')]
debug_ranges = [s for s in sections if s.startswith('.debug_ranges')]
if not debug_ranges or not debug_info:
return 0
range = get_range_for(compilation_unit, debug_info[0])
if range is not None:
return get_range_length(range, debug_ranges[0])
return -1
if __name__ == '__main__':
print main(*sys.argv[1:])

View File

@ -1552,10 +1552,8 @@ if test "$GNU_CC"; then
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
DSO_LDOPTS='-shared'
if test "$GCC_USE_GNU_LD"; then
# Don't allow undefined symbols in libraries, and remove dead symbols
DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs -Wl,--gc-sections"
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
# Don't allow undefined symbols in libraries
DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
fi
WARNINGS_AS_ERRORS='-Werror'
DSO_CFLAGS=''
@ -7301,6 +7299,38 @@ if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
export MOZ_DEBUG_SYMBOLS
fi
dnl ========================================================
dnl = Automatically remove dead symbols
dnl ========================================================
if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
dnl See bug 670659
AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
GC_SECTIONS_BREAKS_DEBUG_RANGES,
[echo 'int foo() {return 42;}' \
'int bar() {return 1;}' \
'int main() {return foo();}' > conftest.${ac_ext}
if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -ffunction-sections -c conftest.${ac_ext} 1>&2]) &&
AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
if test "`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
"`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
GC_SECTIONS_BREAKS_DEBUG_RANGES=no
else
GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
fi
else
dnl We really don't expect to get here, but just in case
AC_ERROR([couldn't compile a simple C file])
fi
rm -rf conftest*])
if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
fi
fi
dnl ========================================================
dnl = Disable any treating of compile warnings as errors
dnl ========================================================

View File

@ -72,7 +72,6 @@ _TEST_FILES = \
test_bug3348.html \
test_bug6296.html \
test_bug24958.html \
test_bug41464.html \
bug100533_load.html \
bug100533_iframe.html \
test_bug100533.html \
@ -179,7 +178,6 @@ _TEST_FILES = \
test_bug529859.html \
test_bug535043.html \
test_bug547850.html \
test_bug457800.html \
test_bug536891.html \
test_bug536895.html \
test_bug458037.xhtml \

View File

@ -75,7 +75,6 @@ function checkFormNoValidateAttribute(aElementName)
"formnovalidate attribute should be disabled");
}
checkFormNoValidateAttribute('input');
checkFormNoValidateAttribute('button');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

View File

@ -40,11 +40,30 @@ reflectLimitedEnumerated({
invalidValues: [ "", "default", "foo", "tulip" ],
});
// TODO: autofocus (boolean)
// TODO: defaultChecked (boolean)
// TODO: checked (boolean)
// TODO: dirName (not implemented)
// TODO: disabled (boolean)
// .autofocus
reflectBoolean({
element: document.createElement("input"),
attribute: "autofocus",
});
// .defaultChecked
reflectBoolean({
element: document.createElement("input"),
attribute: { idl: "defaultChecked", content: "checked" },
});
// .checked doesn't reflect a content attribute.
// .dirName
todo("dirName" in document.createElement("input"),
"dirName isn't implemented yet");
// .disabled
reflectBoolean({
element: document.createElement("input"),
attribute: "disabled",
});
// TODO: form (HTMLFormElement)
// TODO: files (FileList)
// TODO: formAction (URL)
@ -68,7 +87,11 @@ reflectLimitedEnumerated({
defaultValue: "get"
});
// TODO: formNoValidate (boolean)
// .formNoValidate
reflectBoolean({
element: document.createElement("input"),
attribute: "formNoValidate",
});
// .formTarget
reflectString({
@ -78,12 +101,24 @@ reflectString({
});
// TODO: height (non-negative integer)
// TODO: indeterminate (boolean)
// .indeterminate doesn't reflect a content attribute.
// TODO: list (HTMLElement)
// TODO: max (not implemented)
// .max
todo("max" in document.createElement("input"), "max isn't implemented yet");
// TODO: maxLength (long)
// TODO: min (not implemented)
// TODO: multiple (boolean)
// .min
todo("min" in document.createElement("input"), "min isn't implemented yet");
// .multiple
reflectBoolean({
element: document.createElement("input"),
attribute: "multiple",
});
// .name
reflectString({
@ -106,8 +141,17 @@ reflectString({
otherValues: [ "foo\nbar", "foo\rbar", "foo\r\nbar" ],
});
// TODO: readOnly (boolean)
// TODO: required (boolean)
// .readOnly
reflectBoolean({
element: document.createElement("input"),
attribute: "readOnly",
});
// .required
reflectBoolean({
element: document.createElement("input"),
attribute: "required",
});
// .size
reflectUnsignedInt({
@ -118,7 +162,9 @@ reflectUnsignedInt({
});
// TODO: src (URL)
// TODO: step (not implemented)
// .step
todo("step" in document.createElement("input"), "step isn't implemented yet");
// .type
reflectLimitedEnumerated({
@ -141,10 +187,21 @@ reflectString({
});
// .value doesn't reflect a content attribute.
// TODO: valueAsDate (not implemented)
// TODO: valueAsNumber (not implemented)
// TODO: selectedOption (not implemented)
// .valueAsDate
todo("valueAsDate" in document.createElement("input"),
"valueAsDate isn't implemented yet");
// .valueAsNumber
todo("valueAsNumber" in document.createElement("input"),
"valueAsNumber isn't implemented yet");
// .selectedOption
todo("selectedOption" in document.createElement("input"),
"selectedOption isn't implemented yet");
// TODO: width (non-negative integer)
// .willValidate doesn't reflect a content attribute.
// .validity doesn't reflect a content attribute.
// .validationMessage doesn't reflect a content attribute.

View File

@ -26,31 +26,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=345822
/** Test for Bug 345822 **/
function checkRequiredAttribute(element)
{
ok('required' in element, "Element should have the required attribute");
ok(!element.required, "Element required attribute should be disabled");
is(element.getAttribute('required'), null,
"Element required attribute should be disabled");
element.required = true;
ok(element.required, "Element required attribute should be enabled");
isnot(element.getAttribute('required'), null,
"Element required attribute should be enabled");
element.removeAttribute('required');
element.setAttribute('required', '');
ok(element.required, "Element required attribute should be enabled");
isnot(element.getAttribute('required'), null,
"Element required attribute should be enabled");
element.removeAttribute('required');
ok(!element.required, "Element required attribute should be disabled");
is(element.getAttribute('required'), null,
"Element required attribute should be disabled");
}
function checkNotSufferingFromBeingMissing(element, doNotApply)
{
ok(!element.validity.valueMissing,
@ -324,12 +299,8 @@ function checkInputRequiredValidityForFile()
document.forms[0].removeChild(element);
}
checkRequiredAttribute(document.createElement('textarea'));
checkTextareaRequiredValidity();
// Every input element should have the required attribute.
checkRequiredAttribute(document.createElement('input'));
// The require attribute behavior depend of the input type.
// First of all, checks for types that make the element barred from
// constraint validation.

View File

@ -14,22 +14,83 @@
/** Test for HTMLTextAreaElement attributes reflection **/
var textarea = document.createElement("textarea");
reflectUnsignedInt({
element: textarea,
attribute: "rows",
nonZero: true,
defaultValue: 2,
// .autofocus
reflectBoolean({
element: document.createElement("textarea"),
attribute: "autofocus",
});
//.cols
reflectUnsignedInt({
element: textarea,
element: document.createElement("textarea"),
attribute: "cols",
nonZero: true,
defaultValue: 20,
});
todo("dirName" in document.createElement("textarea"),
"dirName isn't implemented yet");
// .disabled
reflectBoolean({
element: document.createElement("textarea"),
attribute: "disabled",
});
// TODO: form (HTMLFormElement)
// TODO: maxLength (long)
// .name
reflectString({
element: document.createElement("textarea"),
attribute: "name",
otherValues: [ "isindex", "_charset_" ],
});
// .placeholder
reflectString({
element: document.createElement("textarea"),
attribute: "placeholder",
otherValues: [ "foo\nbar", "foo\rbar", "foo\r\nbar" ],
});
// .readOnly
reflectBoolean({
element: document.createElement("textarea"),
attribute: "readOnly",
});
// .required
reflectBoolean({
element: document.createElement("textarea"),
attribute: "required",
});
// .rows
reflectUnsignedInt({
element: document.createElement("textarea"),
attribute: "rows",
nonZero: true,
defaultValue: 2,
});
// .wrap
// TODO: make it an enumerated attributes limited to only known values, bug 670869.
reflectString({
element: document.createElement("textarea"),
attribute: "wrap",
otherValues: [ "soft", "hard" ],
});
// .type doesn't reflect a content attribute.
// .defaultValue doesn't reflect a content attribute.
// .value doesn't reflect a content attribute.
// .textLength doesn't reflect a content attribute.
// .willValidate doesn't reflect a content attribute.
// .validity doesn't reflect a content attribute.
// .validationMessage doesn't reflect a content attribute.
// .labels doesn't reflect a content attribute.
</script>
</pre>
</body>

View File

@ -55,11 +55,19 @@ function reflectString(aParameters)
element.removeAttribute(contentAttr);
element[idlAttr] = null;
todo_is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
todo_is(element[idlAttr], "null",
"null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
// TODO: remove this ugly hack when null stringification will work as expected.
if (element.localName == "textarea" && idlAttr == "wrap") {
is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
is(element[idlAttr], "null", "null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
} else {
todo_is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
todo_is(element[idlAttr], "null",
"null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
}
// Tests various strings.
var stringsToTest = [
@ -334,3 +342,105 @@ function reflectLimitedEnumerated(aParameters)
});
}
/**
* Checks that a given attribute is correctly reflected as a boolean.
*
* @param aParameters Object object containing the parameters, which are:
* - element Element node to test on
* - attribute String name of the attribute
* OR
* attribute Object object containing two attributes, 'content' and 'idl'
*/
function reflectBoolean(aParameters)
{
var element = aParameters.element;
var contentAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.content;
var idlAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.idl;
ok(idlAttr in element,
idlAttr + " should be an IDL attribute of this element");
is(typeof element[idlAttr], "boolean",
idlAttr + " IDL attribute should be a boolean");
// Tests when the attribute isn't set.
is(element.getAttribute(contentAttr), null,
"When not set, the content attribute should be null.");
is(element[idlAttr], false,
"When not set, the IDL attribute should return false");
/**
* Test various values.
* Each value to test is actually an object containing a 'value' property
* containing the value to actually test, a 'stringified' property containing
* the stringified value and a 'result' property containing the expected
* result when the value is set to the IDL attribute.
*/
var valuesToTest = [
{ value: true, stringified: "true", result: true },
{ value: false, stringified: "false", result: false },
{ value: "true", stringified: "true", result: true },
{ value: "false", stringified: "false", result: true },
{ value: "foo", stringified: "foo", result: true },
{ value: idlAttr, stringified: idlAttr, result: true },
{ value: contentAttr, stringified: contentAttr, result: true },
{ value: "null", stringified: "null", result: true },
{ value: "undefined", stringified: "undefined", result: true },
{ value: "", stringified: "", result: false },
{ value: undefined, stringified: "undefined", result: false },
{ value: null, stringified: "null", result: false },
{ value: +0, stringified: "0", result: false },
{ value: -0, stringified: "0", result: false },
{ value: NaN, stringified: "NaN", result: false },
{ value: 42, stringified: "42", result: true },
{ value: Infinity, stringified: "Infinity", result: true },
{ value: -Infinity, stringified: "-Infinity", result: true },
// ES5, verse 9.2.
{ value: { toString: function() { return "foo" } }, stringified: "foo",
result: true },
{ value: { valueOf: function() { return "foo" } },
stringified: "[object Object]", result: true },
{ value: { valueOf: function() { return "quux" }, toString: undefined },
stringified: "quux", result: true },
{ value: { valueOf: function() { return "foo" },
toString: function() { return "bar" } }, stringified: "bar",
result: true },
{ value: { valueOf: function() { return false } },
stringified: "[object Object]", result: true },
{ value: { foo: false, bar: false }, stringified: "[object Object]",
result: true },
{ value: { }, stringified: "[object Object]", result: true },
];
valuesToTest.forEach(function(v) {
element.setAttribute(contentAttr, v.value);
is(element[idlAttr], true,
"IDL attribute should return always return 'true' if the content attribute has been set");
if (v.value === null) {
// bug 667856
todo(element.getAttribute(contentAttr), v.stringified,
"Content attribute should return the stringified value it has been set to.");
} else {
is(element.getAttribute(contentAttr), v.stringified,
"Content attribute should return the stringified value it has been set to.");
}
element.removeAttribute(contentAttr);
element[idlAttr] = v.value;
is(element[idlAttr], v.result, "IDL attribute should return " + v.result);
is(element.getAttribute(contentAttr), v.result ? "" : null,
v.result ? "Content attribute should return the empty string."
: "Content attribute should return null.");
is(element.hasAttribute(contentAttr), v.result,
v.result ? contentAttr + " should not be present"
: contentAttr + " should be present");
element.removeAttribute(contentAttr);
});
// Tests after removeAttribute() is called. Should be equivalent with not set.
is(element.getAttribute(contentAttr), null,
"When not set, the content attribute should be null.");
is(element[contentAttr], false,
"When not set, the IDL attribute should return false");
}

View File

@ -1,52 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=41464
-->
<head>
<title>Test for Bug 41464</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=41464">Mozilla Bug 41464</a>
<p id="display"></p>
<div id="content" style="display: none">
<textarea wrap=cheesecake></textarea>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 41464 **/
var textarea = document.getElementById("content").getElementsByTagName("textarea")[0];
is(textarea.wrap, "cheesecake");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "cheesecake");
textarea.setAttribute("wrap", "off");
is(textarea.wrap, "off");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "off");
textarea.wrap = "soft";
is(textarea.wrap, "soft");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "soft");
textarea.wrap = undefined;
is(textarea.wrap, "undefined");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "undefined");
textarea.wrap = null;
is(textarea.wrap, "null");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "null");
textarea.removeAttribute("wrap");
is(textarea.wrap, "");
is(textarea.hasAttribute("wrap"), false);
</script>
</pre>
</body>
</html>

View File

@ -1,57 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=457800
-->
<head>
<title>Test for Bug 457800</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=457800">Mozilla Bug 457800</a>
<p id="display"></p>
<div id="content" style="display: none">
<textarea id="textarea"></textarea>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 457800 **/
function testPlaceholderForElement(element)
{
// init
element.value = ''
// check if {g,s}etAttribute are working
element.setAttribute('placeholder', 'placeholder');
is(element.getAttribute('placeholder'), 'placeholder', "element has no placeholder attribute");
// check if placeholder is working through DOM interface
is(element.placeholder, 'placeholder', "can't read placeholder in DOM interface");
element.placeholder = 'ph';
is(element.placeholder, 'ph', "can't write placeholder in DOM interface");
// check placeholder and value are not interfering
is(element.value, '', "value has changed when placeholder has changed");
element.value = 'value';
is(element.placeholder, 'ph', "placeholder in DOM interface has changed when value has changed");
is(element.getAttribute('placeholder'), 'ph', "placeholder attribute has changed when value has changed");
// check new lines are managed correctly (shouldn't be shown but kept in the DOM)
element.placeholder = 'place\nholder';
is(element.placeholder, 'place\nholder', "\\n shouldn't be stripped");
is(element.getAttribute('placeholder'), 'place\nholder', "\\n shouldn't be stripped");
element.placeholder = 'place\rholder';
is(element.placeholder, 'place\rholder', "\\r shouldn't be stripped");
is(element.getAttribute('placeholder'), 'place\rholder', "\\r shouldn't be stripped");
}
testPlaceholderForElement(document.getElementById('textarea'));
</script>
</pre>
</body>
</html>

View File

@ -13,8 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=546995">Mozilla Bug 546995</a>
<p id="display"></p>
<div id="content" style="display: none">
<input id='i'>
<textarea id='t'></textarea>
<select id='s'></select>
<button id='b'></button>
</div>
@ -36,8 +34,6 @@ function checkAutofocusIDLAttribute(element)
}
// TODO: keygen should be added when correctly implemented, see bug 101019.
checkAutofocusIDLAttribute(document.getElementById('i'));
checkAutofocusIDLAttribute(document.getElementById('t'));
checkAutofocusIDLAttribute(document.getElementById('s'));
checkAutofocusIDLAttribute(document.getElementById('b'));

View File

@ -908,7 +908,9 @@ static const char js_strict_debug_option_str[] = JS_OPTIONS_DOT_STR "strict.debu
static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
static const char js_relimit_option_str[]= JS_OPTIONS_DOT_STR "relimit";
#ifdef JS_GC_ZEAL
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
static const char js_zeal_compartment_str[] = JS_OPTIONS_DOT_STR "gczeal.compartment_gc";
#endif
static const char js_tracejit_content_str[] = JS_OPTIONS_DOT_STR "tracejit.content";
static const char js_tracejit_chrome_str[] = JS_OPTIONS_DOT_STR "tracejit.chrome";
@ -1012,8 +1014,10 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
#ifdef JS_GC_ZEAL
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
PRInt32 frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);
PRBool compartment = Preferences::GetBool(js_zeal_compartment_str, JS_FALSE);
if (zeal >= 0)
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, JS_DEFAULT_ZEAL_FREQ, JS_FALSE);
::JS_SetGCZeal(context->mContext, (PRUint8)zeal, frequency, compartment);
#endif
return 0;

View File

@ -52,13 +52,33 @@ interface nsIScriptGlobalObject;
/**
* Encode and decode JSON text.
*/
[scriptable, uuid(98f12947-5eac-4512-8325-7c9e6a9d8509)]
[scriptable, uuid(a4d68b4e-0c0b-4c7c-b540-ef2f9834171f)]
interface nsIJSON : nsISupports
{
void encodeToStream(in nsIOutputStream stream,
in string charset,
in boolean writeBOM
/* in JSObject value */);
/**
* New users should use JSON.stringify!
* The encode() method is only present for backward compatibility.
* encode() is not a conforming JSON stringify implementation!
*/
[deprecated] AString encode(/* in JSObject value */);
/**
* New users should use JSON.stringify.
* You may also want to have a look at nsIConverterOutputStream.
*
* The encodeToStream() method is only present for backward compatibility.
* encodeToStream() is not a conforming JSON stringify implementation!
*/
[deprecated] void encodeToStream(in nsIOutputStream stream,
in string charset,
in boolean writeBOM
/* in JSObject value */);
/**
* New users should use JSON.parse!
* The decode() method is only present for backward compatibility.
*/
[deprecated] void /* JSObject */ decode(in AString str);
void /* JSObject */ decodeFromStream(in nsIInputStream stream,
in long contentLength);

View File

@ -62,6 +62,7 @@ using nsMouseEvent;
using nsMouseScrollEvent;
using nsKeyEvent;
using RemoteDOMEvent;
using mozilla::WindowsHandle;
namespace mozilla {
namespace dom {
@ -183,6 +184,11 @@ parent:
*/
sync GetDPI() returns (float value);
/**
* Return native data of root widget
*/
sync GetWidgetNativeData() returns (WindowsHandle value);
SetCursor(PRUint32 value);
PContentPermissionRequest(nsCString aType, URI uri);

View File

@ -68,6 +68,7 @@
#include "nsIPromptFactory.h"
#include "nsIContent.h"
#include "nsIWidget.h"
#include "nsIViewManager.h"
#include "mozilla/unused.h"
#include "nsDebug.h"
@ -612,6 +613,29 @@ TabParent::RecvGetDPI(float* aValue)
return true;
}
bool
TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
if (content) {
nsIDocument* document = content->GetOwnerDoc();
if (document) {
nsIPresShell* shell = document->GetShell();
if (shell) {
nsIViewManager* vm = shell->GetViewManager();
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget) {
*aValue = reinterpret_cast<WindowsHandle>(
widget->GetNativeData(NS_NATIVE_WINDOW));
return true;
}
}
}
}
return false;
}
bool
TabParent::ReceiveMessage(const nsString& aMessage,
PRBool aSync,

View File

@ -109,6 +109,7 @@ public:
virtual bool RecvSetIMEOpenState(const PRBool& aValue);
virtual bool RecvSetCursor(const PRUint32& aValue);
virtual bool RecvGetDPI(float* aValue);
virtual bool RecvGetWidgetNativeData(WindowsHandle* aValue);
virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
const nsCString& aName,
const nsCString& aFeatures,

View File

@ -25,7 +25,6 @@ var testObserver = {
observe: function(subject, topic, data) {
observerFired = true;
ok(true, "Observer fired");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
is(topic, "plugin-crashed", "Checking correct topic");
is(data, null, "Checking null data");
ok((subject instanceof Components.interfaces.nsIPropertyBag2), "got Propbag");
@ -50,7 +49,6 @@ var testObserver = {
},
QueryInterface: function(iid) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (iid.equals(Components.interfaces.nsIObserver) ||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
iid.equals(Components.interfaces.nsISupports))
@ -68,8 +66,6 @@ function onPluginCrashed(aEvent) {
var pluginElement = document.getElementById("plugin1");
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
ok(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent,
"plugin crashed event has the right interface");

View File

@ -25,7 +25,6 @@ var testObserver = {
observe: function(subject, topic, data) {
observerFired = true;
ok(true, "Observer fired");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
is(topic, "plugin-crashed", "Checking correct topic");
is(data, null, "Checking null data");
ok((subject instanceof Components.interfaces.nsIPropertyBag2), "got Propbag");
@ -53,7 +52,6 @@ var testObserver = {
},
QueryInterface: function(iid) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (iid.equals(Components.interfaces.nsIObserver) ||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
iid.equals(Components.interfaces.nsISupports))
@ -71,8 +69,6 @@ function onPluginCrashed(aEvent) {
var pluginElement = document.getElementById("plugin1");
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
ok(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent,
"plugin crashed event has the right interface");
var pluginName = aEvent.getData("pluginName");

View File

@ -23,6 +23,7 @@
* Contributor(s):
* Dave Camp <dcamp@mozilla.com>
* Robert Sayre <sayrer@gmail.com>
* Nils Maier <maierman@web.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -75,6 +76,31 @@ nsJSON::~nsJSON()
{
}
NS_IMETHODIMP
nsJSON::Encode(nsAString &aJSON)
{
// This function should only be called from JS.
nsresult rv;
nsJSONWriter writer;
rv = EncodeInternal(&writer);
// FIXME: bug 408838. Get exception types sorted out
if (NS_SUCCEEDED(rv) || rv == NS_ERROR_INVALID_ARG) {
rv = NS_OK;
// if we didn't consume anything, it's not JSON, so return null
if (!writer.DidWrite()) {
aJSON.Truncate();
aJSON.SetIsVoid(PR_TRUE);
} else {
writer.FlushBuffer();
aJSON.Append(writer.mOutputString);
}
}
return rv;
}
static const char UTF8BOM[] = "\xEF\xBB\xBF";
static const char UTF16LEBOM[] = "\xFF\xFE";
static const char UTF16BEBOM[] = "\xFE\xFF";
@ -91,11 +117,6 @@ static nsresult CheckCharset(const char* aCharset)
return NS_OK;
}
//
// void EncodeToStream(in nsIOutputStream stream
// /* in JSObject value,
// /* [optional] in JSObject whitelist */);
//
NS_IMETHODIMP
nsJSON::EncodeToStream(nsIOutputStream *aStream,
const char* aCharset,
@ -205,25 +226,29 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
if (!xpc)
return NS_ERROR_FAILURE;
// Now fish for the JS argument. If it's a call to encode, we'll
// want the first argument. If it's a call to encodeToStream,
// we'll want the forth.
const PRUint32 firstArg = writer->mStream ? 3 : 0;
nsAXPCNativeCallContext *cc = nsnull;
rv = xpc->GetCurrentNativeCallContext(&cc);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 argc = 0;
rv = cc->GetArgc(&argc);
NS_ENSURE_SUCCESS(rv, rv);
// If the argument wasn't provided, there's nothing to serialize.
if (argc <= firstArg)
return NS_OK;
JSContext *cx = nsnull;
rv = cc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, rv);
JSAutoRequest ar(cx);
PRUint32 argc = 0;
rv = cc->GetArgc(&argc);
NS_ENSURE_SUCCESS(rv, rv);
// Now fish for the JS arguments. We want the fourth and fifth arguments to
// encodeToStream.
NS_ABORT_IF_FALSE(writer->mStream != NULL, "should have a stream");
PRUint32 firstArg = 3;
// Get the object we're going to serialize.
jsval *argv = nsnull;
rv = cc->GetArgvPtr(&argv);
@ -231,12 +256,57 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
// If the argument wasn't provided, there's nothing to serialize.
if (argc <= firstArg)
return NS_OK;
return NS_ERROR_INVALID_ARG;
jsval *vp = &argv[firstArg];
// Backward compatibility:
// nsIJSON does not allow to serialize anything other than objects
JSObject *obj;
if (!JSVAL_IS_OBJECT(*vp) || !(obj = JSVAL_TO_OBJECT(*vp)))
return NS_ERROR_INVALID_ARG;
/* Backward compatibility:
* Manually call toJSON if implemented by the object and check that
* the result is still an object
* Note: It is perfectly fine to not implement toJSON, so it is
* perfectly fine for GetMethod to fail
*/
jsval toJSON;
if (JS_GetMethod(cx, obj, "toJSON", NULL, &toJSON) &&
!JSVAL_IS_PRIMITIVE(toJSON) &&
JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(toJSON))) {
// If toJSON is implemented, it must not throw
if (!JS_CallFunctionValue(cx, obj, toJSON, 0, NULL, vp)) {
if (JS_IsExceptionPending(cx))
// passing NS_OK will throw the pending exception
return NS_OK;
// No exception, but still failed
return NS_ERROR_FAILURE;
}
// Backward compatibility:
// nsIJSON does not allow to serialize anything other than objects
if (JSVAL_IS_PRIMITIVE(*vp))
return NS_ERROR_INVALID_ARG;
}
// GetMethod may have thrown
else if (JS_IsExceptionPending(cx))
// passing NS_OK will throw the pending exception
return NS_OK;
// Backward compatibility:
// function/xml shall not pass, just "plain" objects and arrays
JSType type = JS_TypeOfValue(cx, *vp);
if (type == JSTYPE_FUNCTION || type == JSTYPE_XML)
return NS_ERROR_INVALID_ARG;
// We're good now; try to stringify
if (!JS_Stringify(cx, vp, NULL, JSVAL_NULL, WriteCallback, writer))
return NS_ERROR_FAILURE;
return NS_OK;
}
@ -351,6 +421,20 @@ nsJSONWriter::WriteToStream(nsIOutputStream *aStream,
return rv;
}
NS_IMETHODIMP
nsJSON::Decode(const nsAString& json)
{
const PRUnichar *data;
PRUint32 len = NS_StringGetData(json, &data);
nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream),
(const char*) data,
len * sizeof(PRUnichar),
NS_ASSIGNMENT_DEPEND);
NS_ENSURE_SUCCESS(rv, rv);
return DecodeInternal(stream, len, PR_FALSE);
}
NS_IMETHODIMP
nsJSON::DecodeFromStream(nsIInputStream *aStream, PRInt32 aContentLength)
{

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,67 @@ if (!outputDir.exists()) {
do_throw(outputName + " is not a directory?")
}
function testStringEncode()
{
var obj1 = {a:1};
var obj2 = {foo:"bar"};
do_check_eq(nativeJSON.encode(obj1), '{"a":1}');
do_check_eq(nativeJSON.encode(obj2), '{"foo":"bar"}');
do_check_eq(nativeJSON.encode(), null);
// useless roots are dropped
do_check_eq(nativeJSON.encode(null), null);
do_check_eq(nativeJSON.encode(""), null);
do_check_eq(nativeJSON.encode(undefined), null);
do_check_eq(nativeJSON.encode(5), null);
do_check_eq(nativeJSON.encode(function(){}), null);
do_check_eq(nativeJSON.encode(dump), null);
// All other testing should occur in js/src/tests/ecma_5/JSON/ using
// the otherwise-exactly-identical JSON.stringify.
}
function testToJSON() {
var obj1 = {a:1};
var obj2 = {foo:"bar"};
do_check_eq(nativeJSON.encode({toJSON: function() obj1}), '{"a":1}');
do_check_eq(nativeJSON.encode({toJSON: function() obj2}), '{"foo":"bar"}');
do_check_eq(nativeJSON.encode({toJSON: function() null}), null);
do_check_eq(nativeJSON.encode({toJSON: function() ""}), null);
do_check_eq(nativeJSON.encode({toJSON: function() undefined }), null);
do_check_eq(nativeJSON.encode({toJSON: function() 5}), null);
do_check_eq(nativeJSON.encode({toJSON: function() function(){}}), null);
do_check_eq(nativeJSON.encode({toJSON: function() dump}), null);
}
function testThrowingToJSON() {
var obj1 = {
"b": 1,
"c": 2,
toJSON: function() { throw("uh oh"); }
};
try {
var y = nativeJSON.encode(obj1);
throw "didn't throw";
} catch (ex) {
do_check_eq(ex, "uh oh");
}
var obj2 = {
"b": 1,
"c": 2,
get toJSON() { throw("crash and burn"); }
};
try {
var y = nativeJSON.encode(obj2);
throw "didn't throw";
} catch (ex) {
do_check_eq(ex, "crash and burn");
}
}
function testOutputStreams() {
function writeToFile(obj, charset, writeBOM) {
var jsonFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
@ -73,6 +134,10 @@ function testOutputStreams() {
function run_test()
{
testStringEncode();
testToJSON();
testThrowingToJSON();
testOutputStreams();
}

View File

@ -3,5 +3,6 @@ head =
tail =
[test_decodeFromStream.js]
[test_decode_long_input.js]
[test_encode.js]

View File

@ -40,8 +40,6 @@ function execTests() {
body.innerHTML = "1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>";
win.focus();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
function doCommand(cmd) {
var controller = document.commandDispatcher.getControllerForCommand(cmd);
if (controller) {

View File

@ -6536,13 +6536,27 @@ nsHTMLEditRules::ReturnInHeader(nsISelection *aSelection,
NS_ENSURE_SUCCESS(res, res);
if (!sibling || !nsTextEditUtils::IsBreak(sibling))
{
res = CreateMozBR(headerParent, offset+1, address_of(sibling));
// create a paragraph
NS_NAMED_LITERAL_STRING(pType, "p");
nsCOMPtr<nsIDOMNode> pNode;
res = mHTMLEditor->CreateNode(pType, headerParent, offset+1, getter_AddRefs(pNode));
NS_ENSURE_SUCCESS(res, res);
// append a <br> to it
nsCOMPtr<nsIDOMNode> brNode;
res = mHTMLEditor->CreateBR(pNode, 0, address_of(brNode));
NS_ENSURE_SUCCESS(res, res);
// set selection to before the break
res = aSelection->Collapse(pNode, 0);
}
else
{
res = nsEditor::GetNodeLocation(sibling, address_of(headerParent), &offset);
NS_ENSURE_SUCCESS(res, res);
// put selection after break
res = aSelection->Collapse(headerParent,offset+1);
}
res = nsEditor::GetNodeLocation(sibling, address_of(headerParent), &offset);
NS_ENSURE_SUCCESS(res, res);
// put selection after break
res = aSelection->Collapse(headerParent,offset+1);
}
else
{
@ -6779,14 +6793,19 @@ nsHTMLEditRules::ReturnInListItem(nsISelection *aSelection,
res = mHTMLEditor->DeleteNode(aListItem);
NS_ENSURE_SUCCESS(res, res);
// time to insert a break
nsCOMPtr<nsIDOMNode> brNode;
res = CreateMozBR(listparent, offset+1, address_of(brNode));
// time to insert a paragraph
NS_NAMED_LITERAL_STRING(pType, "p");
nsCOMPtr<nsIDOMNode> pNode;
res = mHTMLEditor->CreateNode(pType, listparent, offset+1, getter_AddRefs(pNode));
NS_ENSURE_SUCCESS(res, res);
// set selection to before the moz br
selPriv->SetInterlinePosition(PR_TRUE);
res = aSelection->Collapse(listparent,offset+1);
// append a <br> to it
nsCOMPtr<nsIDOMNode> brNode;
res = mHTMLEditor->CreateBR(pNode, 0, address_of(brNode));
NS_ENSURE_SUCCESS(res, res);
// set selection to before the break
res = aSelection->Collapse(pNode, 0);
}
return res;
}

View File

@ -55,6 +55,7 @@ _TEST_FILES = \
test_bug417418.html \
test_bug432225.html \
test_bug439808.html \
test_bug449243.html \
test_bug455992.html \
test_bug456244.html \
test_bug478725.html \

View File

@ -0,0 +1,137 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=449243
-->
<head>
<title>Test for Bug 449243</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=449243">Mozilla Bug 449243</a>
<p id="display"></p>
<div id="content" contenteditable>
<h2>This is a title</h2>
<ul>
<li>this is a</li>
<li>bullet list</li>
</ul>
<ol>
<li>this is a</li>
<li>numbered list</li>
</ol>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 449243 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
const CARET_BEGIN = 0;
const CARET_MIDDLE = 1;
const CARET_END = 2;
function split(element, caretPos, nbKeyPresses) {
// put the caret on the requested position
var sel = window.getSelection();
var len = element.textContent.length;
var pos = -1;
switch (caretPos) {
case CARET_BEGIN:
pos = 0;
break;
case CARET_MIDDLE:
pos = Math.floor(len/2);
break;
case CARET_END:
pos = len;
break;
}
sel.collapse(element.firstChild, pos);
// simulates a [Return] keypress
for (var i = 0; i < nbKeyPresses; i++)
synthesizeKey("VK_RETURN", {});
}
function undo(nbKeyPresses) {
for (var i = 0; i < nbKeyPresses; i++)
document.execCommand("Undo", false, null);
}
function SameTypeAsPreviousSibling(element) {
var sibling = element.previousSibling;
while (sibling && sibling.nodeType != 1)
sibling = element.previousSibling;
return (element.nodeName == sibling.nodeName);
}
function isParagraph(element) {
return element.nodeName.toLowerCase() == "p";
}
function runTests() {
const content = document.querySelector("[contenteditable]");
const header = content.querySelector("h2");
const ulItem = content.querySelector("ul > li:last-child");
const olItem = content.querySelector("ol > li:last-child");
content.focus();
// beginning of selection: split current node
split(header, CARET_BEGIN, 1);
ok(SameTypeAsPreviousSibling(header),
"Pressing [Return] at the beginning of a header " +
"should create another header.");
split(ulItem, CARET_BEGIN, 2);
ok(SameTypeAsPreviousSibling(ulItem),
"Pressing [Return] at the beginning of an unordered list item " +
"should create another list item.");
split(olItem, CARET_BEGIN, 2);
ok(SameTypeAsPreviousSibling(olItem),
"Pressing [Return] at the beginning of an ordered list item " +
"should create another list item.");
undo(3);
// middle of selection: split current node
split(header, CARET_MIDDLE, 1);
ok(SameTypeAsPreviousSibling(header),
"Pressing [Return] at the middle of a header " +
"should create another header.");
split(ulItem, CARET_MIDDLE, 2);
ok(SameTypeAsPreviousSibling(ulItem),
"Pressing [Return] at the middle of an unordered list item " +
"should create another list item.");
split(olItem, CARET_MIDDLE, 2);
ok(SameTypeAsPreviousSibling(olItem),
"Pressing [Return] at the middle of an ordered list item " +
"should create another list item.");
undo(3);
// end of selection: create a new paragraph
split(header, CARET_END, 1);
ok(isParagraph(content.querySelector("h2+*")),
"Pressing [Return] at the end of a header " +
"should create a new paragraph.");
split(ulItem, CARET_END, 2);
ok(isParagraph(content.querySelector("ul+*")),
"Pressing [Return] twice at the end of an unordered list item " +
"should create a new paragraph.");
split(olItem, CARET_END, 2);
ok(isParagraph(content.querySelector("ol+*")),
"Pressing [Return] twice at the end of an ordered list item " +
"should create a new paragraph.");
undo(3);
// done
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -341,6 +341,14 @@ public class GeckoInputConnection
mComposingText = text != null ? text.toString() : "";
if (!mComposing) {
if (mComposingText.length() == 0) {
// Some IMEs such as iWnn sometimes call with empty composing
// text. (See bug 664364)
// If composing text is empty, ignore this and don't start
// compositing.
return true;
}
// Get current selection
GeckoAppShell.sendEventToGecko(
new GeckoEvent(GeckoEvent.IME_GET_SELECTION, 0, 0));

View File

@ -178,8 +178,12 @@ float4 SampleRadialGradientPS( VS_RADIAL_OUTPUT In) : SV_Target
float upper_t = lerp(t.y, t.x, isValid.x);
float4 output = tex.Sample(sSampler, float2(upper_t, 0.5));
// Premultiply
output *= output.a;
// Multiply the output color by the input mask for the operation.
return tex.Sample(sSampler, float2(upper_t, 0.5)) * mask.Sample(sMaskSampler, In.MaskTexCoord).a;
output *= mask.Sample(sMaskSampler, In.MaskTexCoord).a;
return output;
};
float4 SampleRadialGradientA0PS( VS_RADIAL_OUTPUT In) : SV_Target
@ -201,7 +205,12 @@ float4 SampleRadialGradientA0PS( VS_RADIAL_OUTPUT In) : SV_Target
return float4(0, 0, 0, 0);
}
return tex.Sample(sSampler, float2(t, 0.5)) * mask.Sample(sMaskSampler, In.MaskTexCoord).a;
float4 output = tex.Sample(sSampler, float2(t, 0.5));
// Premultiply
output *= output.a;
// Multiply the output color by the input mask for the operation.
output *= mask.Sample(sMaskSampler, In.MaskTexCoord).a;
return output;
};
float4 SampleShadowHPS( VS_OUTPUT In) : SV_Target

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
License information for hyph_de-1901.dic:
This file is based on the TeX hyphenation patterns distributed under the
LaTeX Project Public License (LPPL) as part of the hyph-utf8 package.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla hyphenation service.
The Initial Developer of the Original Code is
Mozilla Foundation.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Jonathan Kew <jfkthame@gmail.com>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At the time this file was first modified, a complete, unmodified copy of
the LPPL Work was available from:
http://tug.org/svn/texhyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/?pathrev=580
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portions of this file were originally made available under the following license
(copied verbatim from hyph-de-1901.lic.txt in the original work):
German hyphenation patterns (traditional orthography)
(more info about the licence to be added later)
% dehypht-x-2011-06-01.pat
\message{German Hyphenation Patterns (Traditional Orthography) `dehypht-x' 2011-06-01 (WL)}
% TeX-Trennmuster für die traditionelle deutsche Rechtschreibung
%
%
% Copyright (C) 2008, 2009, 2011 Werner Lemberg <wl@gnu.org>
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
%
% The word list is available from
%
% http://repo.or.cz/w/wortliste.git?a=commit;h=2d246449f5c4f570f4d735d3ad091f6ad70f6972
%
% The used patgen parameters are
%
% 1 1 | 2 5 | 1 1 1
% 2 2 | 2 5 | 1 2 1
% 3 3 | 2 6 | 1 1 1
% 4 4 | 2 6 | 1 4 1
% 5 5 | 2 7 | 1 1 1
% 6 6 | 2 7 | 1 6 1
% 7 7 | 2 13 | 1 4 1
% 8 8 | 2 13 | 1 8 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
License information for hyph_de-1996.dic:
This file is based on the TeX hyphenation patterns distributed under the
LaTeX Project Public License (LPPL) as part of the hyph-utf8 package.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla hyphenation service.
The Initial Developer of the Original Code is
Mozilla Foundation.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Jonathan Kew <jfkthame@gmail.com>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At the time this file was first modified, a complete, unmodified copy of
the LPPL Work was available from:
http://tug.org/svn/texhyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/?pathrev=580
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portions of this file were originally made available under the following license
(copied verbatim from hyph-de-1996.lic.txt in the original work):
German hyphenation patterns (reformed orthography)
(more info about the licence to be added later)
% dehyphn-x-2011-06-01.pat
\message{German Hyphenation Patterns (Reformed Orthography, 2006) `dehyphn-x' 2011-06-01 (WL)}
% TeX-Trennmuster für die reformierte (2006) deutsche Rechtschreibung
%
%
% Copyright (C) 2007, 2008, 2009, 2011 Werner Lemberg <wl@gnu.org>
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
%
% The word list is available from
%
% http://repo.or.cz/w/wortliste.git?a=commit;h=2d246449f5c4f570f4d735d3ad091f6ad70f6972
%
% The used patgen parameters are
%
% 1 1 | 2 5 | 1 1 1
% 2 2 | 2 5 | 1 2 1
% 3 3 | 2 6 | 1 1 1
% 4 4 | 2 6 | 1 4 1
% 5 5 | 2 7 | 1 1 1
% 6 6 | 2 7 | 1 6 1
% 7 7 | 2 13 | 1 4 1
% 8 8 | 2 13 | 1 8 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
License information for hyph_de-CH.dic:
This file is based on the TeX hyphenation patterns distributed under the
LaTeX Project Public License (LPPL) as part of the hyph-utf8 package.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla hyphenation service.
The Initial Developer of the Original Code is
Mozilla Foundation.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Jonathan Kew <jfkthame@gmail.com>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At the time this file was first modified, a complete, unmodified copy of
the LPPL Work was available from:
http://tug.org/svn/texhyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/?pathrev=580
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portions of this file were originally made available under the following license
(copied verbatim from hyph-de-ch-1901.lic.txt in the original work):
Swiss-German hyphenation patterns (traditional orthography)
(more info about the licence to be added later)
% dehyphts-x-2011-06-01.pat
\message{Swiss-German Hyphenation Patterns (Traditional Orthography) `dehyphts-x' 2011-06-01 (WL)}
% TeX-Trennmuster für die traditionelle deutsch-schweizerische
% Rechtschreibung
%
%
% Copyright (C) 2009, 2011 Werner Lemberg <wl@gnu.org>
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
%
% The word list is available from
%
% http://repo.or.cz/w/wortliste.git?a=commit;h=2d246449f5c4f570f4d735d3ad091f6ad70f6972
%
% The used patgen parameters are
%
% 1 1 | 2 5 | 1 1 1
% 2 2 | 2 5 | 1 2 1
% 3 3 | 2 6 | 1 1 1
% 4 4 | 2 6 | 1 4 1
% 5 5 | 2 7 | 1 1 1
% 6 6 | 2 7 | 1 6 1
% 7 7 | 2 13 | 1 4 1
% 8 8 | 2 13 | 1 8 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,141 @@
License information for hyph_mn.dic:
This file is based on the TeX hyphenation patterns distributed under the
LaTeX Project Public License (LPPL) as part of the hyph-utf8 package.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla hyphenation service.
The Initial Developer of the Original Code is
Mozilla Foundation.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Jonathan Kew <jfkthame@gmail.com>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At the time this file was first modified, a complete, unmodified copy of
the LPPL Work was available from:
http://tug.org/svn/texhyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/?pathrev=580
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portions of this file were originally made available under the following license
(copied verbatim from hyph-mn-cyrl.lic.txt in the original work):
(New) Mongolian hyphenation patterns
(more info about the licence to be added later)
% This file is part of hyph-utf8 package and resulted from
% semi-manual conversions of hyphenation patterns into UTF-8 in June 2008.
%
% Source: mnhyphn.tex (2008-03-30)
% Author: Dorjgotov Batmunkh <bataak at gmail.com>
%
% The above mentioned file should become obsolete,
% and the author of the original file should preferaby modify this file instead.
%
% Modificatios were needed in order to support native UTF-8 engines,
% but functionality (hopefully) didn't change in any way, at least not intentionally.
% This file is no longer stand-alone; at least for 8-bit engines
% you probably want to use loadhyph-foo.tex (which will load this file) instead.
%
% Modifications were done by Jonathan Kew, Mojca Miklavec & Arthur Reutenauer
% with help & support from:
% - Karl Berry, who gave us free hands and all resources
% - Taco Hoekwater, with useful macros
% - Hans Hagen, who did the unicodifisation of patterns already long before
% and helped with testing, suggestions and bug reports
% - Norbert Preining, who tested & integrated patterns into TeX Live
%
% However, the "copyright/copyleft" owner of patterns remains the original author.
%
% The copyright statement of this file is thus:
%
% Do with this file whatever needs to be done in future for the sake of
% "a better world" as long as you respect the copyright of original file.
% If you're the original author of patterns or taking over a new revolution,
% plese remove all of the TUG comments & credits that we added here -
% you are the Queen / the King, we are only the servants.
%
% If you want to change this file, rather than uploading directly to CTAN,
% we would be grateful if you could send it to us (http://tug.org/tex-hyphen)
% or ask for credentials for SVN repository and commit it yourself;
% we will then upload the whole "package" to CTAN.
%
% Before a new "pattern-revolution" starts,
% please try to follow some guidelines if possible:
%
% - \lccode is *forbidden*, and I really mean it
% - all the patterns should be in UTF-8
% - the only "allowed" TeX commands in this file are: \patterns, \hyphenation,
% and if you really cannot do without, also \input and \message
% - in particular, please no \catcode or \lccode changes,
% they belong to loadhyph-foo.tex,
% and no \lefthyphenmin and \righthyphenmin,
% they have no influence here and belong elsewhere
% - \begingroup and/or \endinput is not needed
% - feel free to do whatever you want inside comments
%
% We know that TeX is extremely powerful, but give a stupid parser
% at least a chance to read your patterns.
%
% For more unformation see
%
% http://tug.org/tex-hyphen
%
%------------------------------------------------------------------------------
%
%% mnhyphn.tex v1.2 2008/03/23 (2010/04/03)
%% Copyright 2007-2010 by Dorjgotov Batmunkh, National University of Mongolia
%% email bataak@gmail.com
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% Special thanks to: Jim Hefferon and Robin Fairbairns
%
% There are few basic rules in mongolian
%
% 1. If there is a consonant then it can use hyphen before it.
% And if there're two consonants then it can use hyphen before second consonant.
% Are there three consonants then it can put hyphen before third consonant,
% also are there four consonants then it can use hyphen before fourth consonant.
% 2. In the case of hardsign or softsign, it's possible to hyphen after these signs.
% For instance, байгуулъ-я, үзүүль-е
% 3. However one vowel can be belong to a syllable, it's not possible to use hyphen.
%

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
License information for hyph_sh.dic:
This file is based on the TeX hyphenation patterns distributed under the
LaTeX Project Public License (LPPL) as part of the hyph-utf8 package.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla hyphenation service.
The Initial Developer of the Original Code is
Mozilla Foundation.
Portions created by the Initial Developer are Copyright (C) 2011
the Initial Developer. All Rights Reserved.
Contributor(s):
Jonathan Kew <jfkthame@gmail.com>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At the time this file was first modified, a complete, unmodified copy of
the LPPL Work was available from:
http://tug.org/svn/texhyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/?pathrev=580
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portions of this file were originally made available under the following license
(combined information from hyph-sh-{latn,cyrl}.lic.txt in the original work):
Serbian hyphenation patterns in {Latin,Cyrillic} script
(more info about the licence to be added later)
% This is `hyph-sh-{latn,cyrl}.tex' version 2.02 as of Jun 22, 2008.
%
% Copyright (C) 1990,2008 Dejan Muhamedagi\'c
% [hyphen patterns for Serbocroatian language]
%
%%% ====================================================================
%%% @TeX-hyphen-file{
%%% author = "Dejan Muhamedagi\'c",
%%% version = "2.02",
%%% date = "22 June 2008",
%%% filename = "hyph-sh-{latn,cyrl}.tex",
%%% email = "dejan@hello-penguin.com",
%%% codetable = "UTF-8",
%%% keywords = "TeX, hyphen, serbocroatian, {latinic,cyrillic}",
%%% supported = "yes",
%%% abstract = "Serbocroatian hyphenation patterns",
%%% docstring = "This file contains the hyphenation patterns
%%% for the Serbocroatian language and the
%%% {latinic,cyrillic} alphabet."
%%% }
%%% ====================================================================
%
% Just the usual stuff: This work is published without any
% waranty, express or implied. And in hope that it will be useful.
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% NB:
% It is allowed to leave one character at the end of the row.
% If you find that awkward these patterns will work well with
% \lefthyphenmin=2.
% \lefthyphenmin=1 \righthyphenmin=2
%
% Osnovni skup paterna dobijen je na osnovu fonolo\v skih osobina
% srpskohrvatskog jezika. Pravila i preporuke sam preuzeo iz:
%
% M. Pe\v sikan, J. Jerkovi\'c, M. Pi\v zurica:
% Pravopis srpskoga jezika
% Matica srpska, Novi Sad, 1995.
%
% U drugom delu se nalaze izuzeci od fonolo\v skih pravila bazirani
% na boljem psiholo\v skom prelomu re\v ci. Izradjen je kori\v s\'cenjem
% slede\'cih re\v cnika:
%
% Re\v cnik srpskohrvatskoga knji\v zevnog jezika
% Matica srpska, Matica hrvatska, Novi Sad, Zagreb, 1967-1976.
%
% Milan Vujaklija: Leksikon stranih re\v ci i izraza
% Prosveta, Beograd, 1992.
%
% -----------------------------------------------------------------
%

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,10 @@ typedef gfxPattern::GraphicsFilter GraphicsFilterType;
typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
typedef LayerManager::LayersBackend LayersBackend;
// This is a cross-platform approximation to HANDLE, which we expect
// to be typedef'd to void* or thereabouts.
typedef uintptr_t WindowsHandle;
// XXX there are out of place and might be generally useful. Could
// move to nscore.h or something.
struct void_t {

View File

@ -485,11 +485,20 @@ CPPSRCS += \
Library.cpp \
$(NULL)
LOCAL_INCLUDES = \
-Ictypes/libffi/include \
ifdef MOZ_NATIVE_FFI
LOCAL_INCLUDES = $(MOZ_FFI_CFLAGS)
else
LOCAL_INCLUDES = -Ictypes/libffi/include
endif
LOCAL_INCLUDES += \
-I. \
$(NULL)
ifdef MOZ_NATIVE_FFI
EXTRA_DSO_LDOPTS += $(MOZ_FFI_LIBS)
else
ifeq ($(OS_ARCH),OS2)
SHARED_LIBRARY_LIBS += \
ctypes/libffi/.libs/ffi.a \
@ -499,6 +508,7 @@ SHARED_LIBRARY_LIBS += \
ctypes/libffi/.libs/libffi.$(LIB_SUFFIX) \
$(NULL)
endif
endif
endif # JS_HAS_CTYPES
@ -587,6 +597,7 @@ endif
include $(topsrcdir)/config/rules.mk
ifdef JS_HAS_CTYPES
ifndef MOZ_NATIVE_FFI
# Build libffi proper as part of the 'exports' target, so things get built
# in the right order.
export::
@ -595,6 +606,7 @@ export::
distclean clean::
$(call SUBMAKE,$@,ctypes/libffi)
endif
endif
# Because the SpiderMonkey can be distributed and built independently
# of the Mozilla source tree, it contains its own copies of many of

View File

@ -247,6 +247,10 @@ NSPR_CONFIG = @NSPR_CONFIG@
NSPR_CFLAGS = @NSPR_CFLAGS@
NSPR_LIBS = @NSPR_LIBS@
MOZ_NATIVE_FFI = @MOZ_NATIVE_FFI@
MOZ_FFI_LIBS = @MOZ_FFI_LIBS@
MOZ_FFI_CFLAGS = @MOZ_FFI_CFLAGS@
USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@

View File

@ -4390,6 +4390,25 @@ if test -n "$MOZ_NATIVE_NSPR"; then
CFLAGS=$_SAVE_CFLAGS
fi
dnl ========================================================
dnl system libffi Support
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(system-ffi,
[ --enable-system-ffi Use system libffi (located with pkgconfig)],
MOZ_NATIVE_FFI=1 )
if test -n "$MOZ_NATIVE_FFI"; then
# Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
# for non-GCC compilers.
if test -z "$GNU_CC"; then
PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
else
PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
fi
fi
AC_SUBST(MOZ_NATIVE_FFI)
dnl ========================================================
dnl =
dnl = Application
@ -5978,7 +5997,7 @@ AC_MSG_RESULT(invoking make to create js-config script)
$GMAKE js-config
# Build jsctypes if it's enabled.
if test "$JS_HAS_CTYPES"; then
if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
# Run the libffi 'configure' script.
ac_configure_args="--disable-shared --enable-static --disable-raw-api"
if test "$MOZ_DEBUG"; then

View File

@ -19,13 +19,13 @@ function test0() {
assertEq(script1.call(null, 1), 1);
assertEq(script1.call(null, 1,2), 2);
assertEq(native1.call("aabc", /b/), 2);
assertEq(native1.call("abc"), -1);
assertEq(native1.call("abc"), 0);
assertEq(tricky1.call(null, 9), 9);
assertEq(script1.apply(null), 0);
assertEq(script1.apply(null, [1]), 1);
assertEq(script1.apply(null, [1,2]), 2);
assertEq(native1.apply("aabc", [/b/]), 2);
assertEq(native1.apply("abc"), -1);
assertEq(native1.apply("abc"), 0);
assertEq(tricky1.apply(null, 1), 1);
}
test0();

View File

@ -2881,7 +2881,8 @@ NewCompartment(JSContext *cx, JSPrincipals *principals)
JSRuntime *rt = cx->runtime;
JSCompartment *compartment = cx->new_<JSCompartment>(rt);
if (compartment && compartment->init()) {
// The trusted compartment is a system compartment.
// Any compartment with the trusted principals -- and there can be
// multiple -- is a system compartment.
compartment->isSystemCompartment = principals && rt->trustedPrincipals() == principals;
if (principals) {
compartment->principals = principals;

View File

@ -598,12 +598,7 @@ ExecuteRegExp(JSContext *cx, ExecType execType, uintN argc, Value *vp)
if (!obj)
return false;
if (!obj->isRegExp()) {
JSFunction *fun = vp[0].toObject().getFunctionPrivate();
JSAutoByteString funNameBytes;
if (const char *funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO,
"RegExp", funName, obj->getClass()->name);
}
ReportIncompatibleMethod(cx, vp, &js_RegExpClass);
return false;
}
@ -619,29 +614,10 @@ ExecuteRegExp(JSContext *cx, ExecType execType, uintN argc, Value *vp)
RegExpStatics *res = cx->regExpStatics();
/* Step 2. */
JSString *input;
if (argc > 0) {
input = js_ValueToString(cx, vp[2]);
if (!input)
return false;
vp[2] = StringValue(input);
} else {
/* NON-STANDARD: Grab input from statics. */
input = res->getPendingInput();
if (!input) {
JSAutoByteString sourceBytes(cx, re->getSource());
if (!!sourceBytes) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NO_INPUT,
sourceBytes.ptr(),
re->global() ? "g" : "",
re->ignoreCase() ? "i" : "",
re->multiline() ? "m" : "",
re->sticky() ? "y" : "");
}
return false;
}
}
JSString *input = js_ValueToString(cx, argc > 0 ? vp[2] : UndefinedValue());
if (!input)
return false;
/* Step 3. */
size_t length = input->length();

View File

@ -341,11 +341,12 @@ RegExp::executeInternal(JSContext *cx, RegExpStatics *res, JSString *inputstr,
*/
for (int *it = buf; it != buf + matchItemCount; ++it)
*it = -1;
JSLinearString *input = inputstr->ensureLinear(cx);
if (!input)
return false;
JS::Anchor<JSString *> anchor(input);
size_t len = input->length();
const jschar *chars = input->chars();

View File

@ -1339,11 +1339,16 @@ class RegExpGuard
/* init must succeed in order to call tryFlatMatch or normalizeRegExp. */
bool
init(uintN argc, Value *vp)
init(uintN argc, Value *vp, bool convertVoid = false)
{
if (argc != 0 && VALUE_IS_REGEXP(cx, vp[2])) {
rep.reset(vp[2].toObject());
} else {
if (convertVoid && (argc == 0 || vp[2].isUndefined())) {
fm.patstr = cx->runtime->emptyString;
return true;
}
fm.patstr = ArgToRootedString(cx, argc, vp, 0);
if (!fm.patstr)
return false;
@ -1542,9 +1547,9 @@ str_match(JSContext *cx, uintN argc, Value *vp)
JSString *str = ThisToStringForStringProto(cx, vp);
if (!str)
return false;
RegExpGuard g(cx);
if (!g.init(argc, vp))
if (!g.init(argc, vp, true))
return false;
if (const FlatMatch *fm = g.tryFlatMatch(cx, str, 1, argc))
return BuildFlatMatchArray(cx, str, *fm, vp);
@ -1577,7 +1582,7 @@ str_search(JSContext *cx, uintN argc, Value *vp)
return false;
RegExpGuard g(cx);
if (!g.init(argc, vp))
if (!g.init(argc, vp, true))
return false;
if (const FlatMatch *fm = g.tryFlatMatch(cx, str, 1, argc)) {
vp->setInt32(fm->match());
@ -1585,6 +1590,7 @@ str_search(JSContext *cx, uintN argc, Value *vp)
}
if (cx->isExceptionPending()) /* from tryFlatMatch */
return false;
const RegExpPair *rep = g.normalizeRegExp(false, 1, argc, vp);
if (!rep)
return false;

View File

@ -381,7 +381,12 @@ struct FPRegisters {
typedef JSC::MacroAssembler::FPRegisterID FPRegisterID;
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
#ifdef _WIN64
/* xmm0-xmm5 are scratch register on Win64 ABI */
static const uint32 TotalFPRegisters = 6;
#else
static const uint32 TotalFPRegisters = 8;
#endif
static const uint32 TempFPRegs =
(1 << JSC::X86Registers::xmm0)
| (1 << JSC::X86Registers::xmm1)
@ -389,8 +394,11 @@ struct FPRegisters {
| (1 << JSC::X86Registers::xmm3)
| (1 << JSC::X86Registers::xmm4)
| (1 << JSC::X86Registers::xmm5)
#ifndef _WIN64
| (1 << JSC::X86Registers::xmm6)
| (1 << JSC::X86Registers::xmm7);
| (1 << JSC::X86Registers::xmm7)
#endif
;
/* FIXME: Temporary hack until FPRegister allocation exists. */
static const FPRegisterID First = JSC::X86Registers::xmm0;
static const FPRegisterID Second = JSC::X86Registers::xmm1;

View File

@ -54,6 +54,9 @@ CPPSRCS = \
DEFINES += -DEXPORT_JS_API
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
ifdef MOZ_NATIVE_FFI
EXTRA_LIBS += $(MOZ_FFI_LIBS)
endif
LOCAL_INCLUDES += -I$(topsrcdir) -I..

View File

@ -463,6 +463,8 @@ OptionParser::~OptionParser()
{
for (Option **it = options.begin(), **end = options.end(); it != end; ++it)
Foreground::delete_<Option>(*it);
for (Option **it = arguments.begin(), **end = arguments.end(); it != end; ++it)
Foreground::delete_<Option>(*it);
}
Option *

View File

@ -13,4 +13,5 @@ script builtin-methods-reject-null-undefined-this.js
script regress-bug632003.js
script new-with-non-constructor.js
script error-undefined-message.js
script regexp-functions-with-undefined.js
script unnamed-function.js

View File

@ -0,0 +1,43 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
var a = /undefined/.exec();
assertEq(a[0], 'undefined');
assertEq(a.length, 1);
a = /undefined/.exec(undefined);
assertEq(a[0], 'undefined');
assertEq(a.length, 1);
assertEq(/undefined/.test(), true);
assertEq(/undefined/.test(undefined), true);
assertEq(/aaaa/.exec(), null);
assertEq(/aaaa/.exec(undefined), null);
assertEq(/aaaa/.test(), false);
assertEq(/aaaa/.test(undefined), false);
assertEq("undefined".search(), 0);
assertEq("undefined".search(undefined), 0);
assertEq("aaaa".search(), 0);
assertEq("aaaa".search(undefined), 0);
a = "undefined".match();
assertEq(a[0], "");
assertEq(a.length, 1);
a = "undefined".match(undefined);
assertEq(a[0], "");
assertEq(a.length, 1);
a = "aaaa".match();
assertEq(a[0], "");
assertEq(a.length, 1);
a = "aaaa".match(undefined);
assertEq(a[0], "");
assertEq(a.length, 1);
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
Filename: RegExp_input.js
Description: 'Tests RegExps input property'
Author: Nick Lerissa
Date: March 13, 1998
*/
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
var VERSION = 'no version';
startTest();
var TITLE = 'RegExp: input';
writeHeaderToLog('Executing script: RegExp_input.js');
writeHeaderToLog( SECTION + " "+ TITLE);
RegExp.input = "abcd12357efg";
// RegExp.input = "abcd12357efg"; RegExp.input
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input",
"abcd12357efg", RegExp.input);
// RegExp.input = "abcd12357efg"; /\d+/.exec('2345')
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')",
String(["2345"]), String(/\d+/.exec('2345')));
// RegExp.input = "abcd12357efg"; /\d+/.exec()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec()",
String(["12357"]), String(/\d+/.exec()));
// RegExp.input = "abcd12357efg"; /[h-z]+/.exec()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec()",
null, /[h-z]+/.exec());
// RegExp.input = "abcd12357efg"; /\d+/.test('2345')
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')",
true, /\d+/.test('2345'));
// RegExp.input = "abcd12357efg"; /\d+/.test()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test()",
true, /\d+/.test());
// RegExp.input = "abcd12357efg"; (new RegExp('d+')).test()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test()",
true, (new RegExp('d+')).test());
// RegExp.input = "abcd12357efg"; /[h-z]+/.test()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test()",
false, /[h-z]+/.test());
// RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test()
RegExp.input = "abcd12357efg";
new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
false, (new RegExp('[h-z]+')).test());
test();

View File

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
Filename: RegExp_input_as_array.js
Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)'
Author: Nick Lerissa
Date: March 13, 1998
*/
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
var VERSION = 'no version';
startTest();
var TITLE = 'RegExp: input';
writeHeaderToLog('Executing script: RegExp_input.js');
writeHeaderToLog( SECTION + " "+ TITLE);
RegExp['$_'] = "abcd12357efg";
// RegExp['$_'] = "abcd12357efg"; RegExp['$_']
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']",
"abcd12357efg", RegExp['$_']);
// RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345')
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')",
String(["2345"]), String(/\d+/.exec('2345')));
// RegExp['$_'] = "abcd12357efg"; /\d+/.exec()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec()",
String(["12357"]), String(/\d+/.exec()));
// RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec()",
null, /[h-z]+/.exec());
// RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345')
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')",
true, /\d+/.test('2345'));
// RegExp['$_'] = "abcd12357efg"; /\d+/.test()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test()",
true, /\d+/.test());
// RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test()",
false, /[h-z]+/.test());
// RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test()",
true, (new RegExp('\d+')).test());
// RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test()
RegExp['$_'] = "abcd12357efg";
new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
false, (new RegExp('[h-z]+')).test());
test();

View File

@ -1,7 +1,5 @@
url-prefix ../../jsreftest.html?test=js1_2/regexp/
script RegExp_dollar_number.js
script RegExp_input.js
script RegExp_input_as_array.js
skip script RegExp_lastIndex.js # obsolete test
script RegExp_lastMatch.js
script RegExp_lastMatch_as_array.js

View File

@ -2,7 +2,7 @@ function f(code) {
code.replace(/s/, "")
eval(code)
}
this.__defineGetter__("x", function() { return /x/.exec(); })
this.__defineGetter__("x", function() { return /x/.exec('x'); })
f("function a() {\
x = Proxy.createFunction((function () {\
return {\

View File

@ -1835,6 +1835,21 @@ main(int argc, char **argv, char **envp)
}
{
if (argc > 1 && !strcmp(argv[1], "--greomni")) {
nsCOMPtr<nsILocalFile> greOmni;
nsCOMPtr<nsILocalFile> appOmni;
XRE_GetFileFromPath(argv[2], getter_AddRefs(greOmni));
if (argc > 3 && !strcmp(argv[3], "--appomni")) {
XRE_GetFileFromPath(argv[4], getter_AddRefs(appOmni));
argc-=2;
argv+=2;
}
XRE_InitOmnijar(greOmni, appOmni);
argc-=2;
argv+=2;
}
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), appDir, &dirprovider);
if (NS_FAILED(rv)) {

View File

@ -1613,7 +1613,13 @@ public:
#define BYTES(path, kind, amount, desc) \
callback->Callback(p, path, kind, nsIMemoryReporter::UNITS_BYTES, \
amount, NS_LITERAL_CSTRING(desc), closure);
amount, NS_LITERAL_CSTRING(desc), closure)
#define BYTES0(path, kind, amount, desc) \
do { \
if (amount != 0) \
BYTES(path, kind, amount, desc); \
} while (0)
#define PERCENTAGE(path, kind, amount, desc) \
callback->Callback(p, path, kind, nsIMemoryReporter::UNITS_PERCENTAGE, \
@ -1634,28 +1640,28 @@ public:
gcHeapArenaUnused += stats->gcHeapArenaUnused;
BYTES(mkPath(name, "gc-heap/arena-headers"),
BYTES0(mkPath(name, "gc-heap/arena-headers"),
JS_GC_HEAP_KIND, stats->gcHeapArenaHeaders,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is used to hold internal book-keeping information.");
BYTES(mkPath(name, "gc-heap/arena-padding"),
BYTES0(mkPath(name, "gc-heap/arena-padding"),
JS_GC_HEAP_KIND, stats->gcHeapArenaPadding,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is unused and present only so that other data is aligned. "
"This constitutes internal fragmentation.");
BYTES(mkPath(name, "gc-heap/arena-unused"),
BYTES0(mkPath(name, "gc-heap/arena-unused"),
JS_GC_HEAP_KIND, stats->gcHeapArenaUnused,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that could be holding useful data but currently isn't.");
BYTES(mkPath(name, "gc-heap/objects"),
BYTES0(mkPath(name, "gc-heap/objects"),
JS_GC_HEAP_KIND, stats->gcHeapObjects,
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"objects.");
BYTES(mkPath(name, "gc-heap/strings"),
BYTES0(mkPath(name, "gc-heap/strings"),
JS_GC_HEAP_KIND, stats->gcHeapStrings,
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"string headers. String headers contain various pieces of information "
@ -1663,18 +1669,18 @@ public:
"strings) the string characters; characters in longer strings are counted "
"under 'gc-heap/string-chars' instead.");
BYTES(mkPath(name, "gc-heap/shapes"),
BYTES0(mkPath(name, "gc-heap/shapes"),
JS_GC_HEAP_KIND, stats->gcHeapShapes,
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"shapes. A shape is an internal data structure that makes JavaScript "
"property accesses fast.");
BYTES(mkPath(name, "gc-heap/xml"),
BYTES0(mkPath(name, "gc-heap/xml"),
JS_GC_HEAP_KIND, stats->gcHeapXml,
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"E4X XML objects.");
BYTES(mkPath(name, "object-slots"),
BYTES0(mkPath(name, "object-slots"),
nsIMemoryReporter::KIND_HEAP, stats->objectSlots,
"Memory allocated for the compartment's non-fixed object slot arrays, "
"which are used to represent object properties. Some objects also "
@ -1682,7 +1688,7 @@ public:
"JavaScript heap; those slots are not counted here, but in "
"'gc-heap/objects' instead.");
BYTES(mkPath(name, "string-chars"),
BYTES0(mkPath(name, "string-chars"),
nsIMemoryReporter::KIND_HEAP, stats->stringChars,
"Memory allocated to hold the compartment's string characters. Sometimes "
"more memory is allocated than necessary, to simplify string "
@ -1690,7 +1696,7 @@ public:
"compartment's JavaScript heap; that header is not counted here, but in "
"'gc-heap/strings' instead.");
BYTES(mkPath(name, "scripts"),
BYTES0(mkPath(name, "scripts"),
nsIMemoryReporter::KIND_HEAP, stats->scripts,
"Memory allocated for the compartment's JSScripts. A JSScript is created "
"for each user-defined function in a script. One is also created for "
@ -1698,26 +1704,26 @@ public:
"various other things.");
#ifdef JS_METHODJIT
BYTES(mkPath(name, "mjit-code"),
BYTES0(mkPath(name, "mjit-code"),
nsIMemoryReporter::KIND_NONHEAP, stats->mjitCode,
"Memory used by the method JIT to hold the compartment's generated code.");
BYTES(mkPath(name, "mjit-data"),
BYTES0(mkPath(name, "mjit-data"),
nsIMemoryReporter::KIND_HEAP, stats->mjitData,
"Memory used by the method JIT for the compartment's compilation data: "
"JITScripts, native maps, and inline cache structs.");
#endif
#ifdef JS_TRACER
BYTES(mkPath(name, "tjit-code"),
BYTES0(mkPath(name, "tjit-code"),
nsIMemoryReporter::KIND_NONHEAP, stats->tjitCode,
"Memory used by the trace JIT to hold the compartment's generated code.");
BYTES(mkPath(name, "tjit-data/allocators-main"),
BYTES0(mkPath(name, "tjit-data/allocators-main"),
nsIMemoryReporter::KIND_HEAP, stats->tjitDataAllocatorsMain,
"Memory used by the trace JIT to store the compartment's trace-related "
"data. This data is allocated via the compartment's VMAllocators.");
BYTES(mkPath(name, "tjit-data/allocators-reserve"),
BYTES0(mkPath(name, "tjit-data/allocators-reserve"),
nsIMemoryReporter::KIND_HEAP, stats->tjitDataAllocatorsReserve,
"Memory used by the trace JIT and held in reserve for the compartment's "
"VMAllocators in case of OOM.");

View File

@ -26,9 +26,9 @@
}
function runTests() {
var testCanvas = snapshotWindow(window);
var testCanvas = window.opener.SpecialPowers.snapshotWindow(window);
var refCanvas = snapshotWindow(window);
var refCanvas = window.opener.SpecialPowers.snapshotWindow(window);
var ctx = refCanvas.getContext('2d');
ctx.fillStyle = "black";
ctx.fillRect(0, 0, refCanvas.width, refCanvas.height);

View File

@ -18,7 +18,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=536567
/** Test for Bug 536567 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
@ -37,8 +36,6 @@ var homeDir = dirSvc.get("Desk", Ci.nsILocalFile);
prefSvc.setBoolPref("browser.privatebrowsing.keep_current_session", true);
function newDir() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var dir = tmpDir.clone();
dir.append("testdir" + Math.floor(Math.random() * 10000));
dir.QueryInterface(Ci.nsILocalFile);
@ -137,8 +134,6 @@ function endTest() {
}
window.addEventListener("message", function(event) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var test = tests[testIndex];
var returned = -1;
for (var i = 0; i < dirs.length; i++) {

View File

@ -0,0 +1,19 @@
<!doctype html>
<head>
<style>
body {
background-color: blue;
}
</style>
<body>
<canvas id="mycanvas" width="200" height="200"></canvas>
<script type="text/javascript">
var cx = document.getElementById('mycanvas').getContext('2d');
cx.beginPath();
cx.arc(100, 100, 80, 0, Math.PI*2, true);
cx.closePath();
cx.fillStyle = "white";
cx.fill();
</script>

View File

@ -0,0 +1,24 @@
<!doctype html>
<head>
<style>
body {
background-color: blue;
}
</style>
<body>
<canvas id="mycanvas" width="200" height="200"></canvas>
<script type="text/javascript">
var cx = document.getElementById('mycanvas').getContext('2d');
var g = cx.createRadialGradient(100, 100, 50, 100, 100, 75);
g.addColorStop(0, 'rgba(100%, 100%, 0%, 0.5)');
g.addColorStop(1, 'rgba(100%, 100%, 0%, 0)');
cx.fillStyle = g;
cx.fillRect(0, 0, 200, 200);
cx.beginPath();
cx.arc(100, 100, 80, 0, Math.PI*2, true);
cx.closePath();
cx.fillStyle = "white";
cx.fill();
</script>

View File

@ -64,3 +64,5 @@ random-if(Android) == dash-1.html dash-1-ref.svg # Bug 668412 (really is androi
== ctm-sanity.html data:text/html,<body>Pass
fails == ctm-singular-sanity.html data:text/html,<body>Pass # Bug 612033
== ctm-1.html ctm-1-ref.html
fails-if(cocoaWidget) == 672646-alpha-radial-gradient.html 672646-alpha-radial-gradient-ref.html # Bug 673333

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="de-1901">
Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
<p>
bu&shy;sser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="de-1901">
Alle Menschen sind frei und gleich an Würde und Rechten geboren.
<p>
busser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="de-1996">
Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
<p>
bus&shy;ser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="de-1996">
Alle Menschen sind frei und gleich an Würde und Rechten geboren.
<p>
busser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="de-CH">
Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="de-CH">
Alle Menschen sind frei und gleich an Würde und Rechten geboren.
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="mn">
Хүн бүр төрж мэнд&shy;лэ&shy;хэд эрх чө&shy;лөө&shy;тэй, адил&shy;хан нэр төр&shy;тэй, ижил эрх&shy;тэй бай&shy;даг
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="mn">
Хүн бүр төрж мэндлэхэд эрх чөлөөтэй, адилхан нэр төртэй, ижил эрхтэй байдаг
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="sh">
Сва људ&shy;ска би&shy;ћа ра&shy;ђа&shy;ју се сло&shy;бод&shy;на и јед&shy;на&shy;ка у до&shy;сто&shy;јан&shy;ству и пра&shy;ви&shy;ма.
<p>
Sva ljud&shy;ska bi&shy;ća ra&shy;đa&shy;ju se slo&shy;bod&shy;na i jed&shy;na&shy;ka u do&shy;sto&shy;jan&shy;stvu i pra&shy;vi&shy;ma.
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="sh">
Сва људска бића рађају се слободна и једнака у достојанству и правима.
<p>
Sva ljudska bića rađaju se slobodna i jednaka u dostojanstvu i pravima.
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:manual;" lang="sr">
Сва људ&shy;ска би&shy;ћа ра&shy;ђа&shy;ју се сло&shy;бод&shy;на и јед&shy;на&shy;ка у до&shy;сто&shy;јан&shy;ству и пра&shy;ви&shy;ма.
<p>
Sva ljud&shy;ska bi&shy;ća ra&shy;đa&shy;ju se slo&shy;bod&shy;na i jed&shy;na&shy;ka u do&shy;sto&shy;jan&shy;stvu i pra&shy;vi&shy;ma.
</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div style="width:1em; -moz-hyphens:auto;" lang="sr">
Сва људска бића рађају се слободна и једнака у достојанству и правима.
<p>
Sva ljudska bića rađaju se slobodna i jednaka u dostojanstvu i pravima.
</div>
</body>
</html>

View File

@ -119,3 +119,10 @@ random-if(!winWidget) == arial-bold-lam-alef-1.html arial-bold-lam-alef-1-ref.ht
== auto-hyphenation-pt-1.html auto-hyphenation-pt-1-ref.html
== auto-hyphenation-sl-1.html auto-hyphenation-sl-1-ref.html
== auto-hyphenation-uk-1.html auto-hyphenation-uk-1-ref.html
== auto-hyphenation-de-1901-1.html auto-hyphenation-de-1901-1-ref.html
== auto-hyphenation-de-1996-1.html auto-hyphenation-de-1996-1-ref.html
!= auto-hyphenation-de-1901-1.html auto-hyphenation-de-1996-1.html
== auto-hyphenation-mn-1.html auto-hyphenation-mn-1-ref.html
== auto-hyphenation-sh-1.html auto-hyphenation-sh-1-ref.html
== auto-hyphenation-sr-1.html auto-hyphenation-sr-1-ref.html
== auto-hyphenation-de-ch-1.html auto-hyphenation-de-ch-1-ref.html

View File

@ -14,7 +14,6 @@
<script type="application/javascript; version=1.8">
var [gStyleSheetService, gIOService] = (function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
return [
Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService),
@ -24,13 +23,11 @@ var [gStyleSheetService, gIOService] = (function() {
})();
function set_user_sheet(sheeturi)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var uri = gIOService.newURI(sheeturi, null, null);
gStyleSheetService.loadAndRegisterSheet(uri, gStyleSheetService.USER_SHEET);
}
function remove_user_sheet(sheeturi)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var uri = gIOService.newURI(sheeturi, null, null);
gStyleSheetService.unregisterSheet(uri, gStyleSheetService.USER_SHEET);
}

View File

@ -0,0 +1,162 @@
diff --git a/media/libvpx/vp8/vp8_dx_iface.c b/media/libvpx/vp8/vp8_dx_iface.c
--- a/media/libvpx/vp8/vp8_dx_iface.c
+++ b/media/libvpx/vp8/vp8_dx_iface.c
@@ -315,16 +315,46 @@ update_error_state(vpx_codec_alg_priv_t
if ((res = error->error_code))
ctx->base.err_detail = error->has_detail
? error->detail
: NULL;
return res;
}
+static void yuvconfig2image(vpx_image_t *img,
+ const YV12_BUFFER_CONFIG *yv12,
+ void *user_priv)
+{
+ /** vpx_img_wrap() doesn't allow specifying independent strides for
+ * the Y, U, and V planes, nor other alignment adjustments that
+ * might be representable by a YV12_BUFFER_CONFIG, so we just
+ * initialize all the fields.*/
+ img->fmt = yv12->clrtype == REG_YUV ?
+ VPX_IMG_FMT_I420 : VPX_IMG_FMT_VPXI420;
+ img->w = yv12->y_stride;
+ img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
+ img->d_w = yv12->y_width;
+ img->d_h = yv12->y_height;
+ img->x_chroma_shift = 1;
+ img->y_chroma_shift = 1;
+ img->planes[VPX_PLANE_Y] = yv12->y_buffer;
+ img->planes[VPX_PLANE_U] = yv12->u_buffer;
+ img->planes[VPX_PLANE_V] = yv12->v_buffer;
+ img->planes[VPX_PLANE_ALPHA] = NULL;
+ img->stride[VPX_PLANE_Y] = yv12->y_stride;
+ img->stride[VPX_PLANE_U] = yv12->uv_stride;
+ img->stride[VPX_PLANE_V] = yv12->uv_stride;
+ img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
+ img->bps = 12;
+ img->user_priv = user_priv;
+ img->img_data = yv12->buffer_alloc;
+ img->img_data_owner = 0;
+ img->self_allocd = 0;
+}
static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
const uint8_t *data,
unsigned int data_sz,
void *user_priv,
long deadline)
{
vpx_codec_err_t res = VPX_CODEC_OK;
@@ -424,30 +454,18 @@ static vpx_codec_err_t vp8_decode(vpx_co
if (vp8dx_receive_compressed_data(ctx->pbi, data_sz, data, deadline))
{
VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi;
res = update_error_state(ctx, &pbi->common.error);
}
if (!res && 0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, ppdeblocking, ppnoise, ppflag))
{
- /* Align width/height */
- unsigned int a_w = (sd.y_width + 15) & ~15;
- unsigned int a_h = (sd.y_height + 15) & ~15;
-
- vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
- a_w + 2 * VP8BORDERINPIXELS,
- a_h + 2 * VP8BORDERINPIXELS,
- 1,
- sd.buffer_alloc);
- vpx_img_set_rect(&ctx->img,
- VP8BORDERINPIXELS, VP8BORDERINPIXELS,
- sd.y_width, sd.y_height);
+ yuvconfig2image(&ctx->img, &sd, user_priv);
ctx->img_avail = 1;
-
}
}
return res;
}
static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t *ctx,
vpx_codec_iter_t *iter)
diff --git a/media/libvpx/vpx_scale/generic/yv12config.c b/media/libvpx/vpx_scale/generic/yv12config.c
--- a/media/libvpx/vpx_scale/generic/yv12config.c
+++ b/media/libvpx/vpx_scale/generic/yv12config.c
@@ -42,50 +42,61 @@ vp8_yv12_de_alloc_frame_buffer(YV12_BUFF
/****************************************************************************
*
****************************************************************************/
int
vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border)
{
/*NOTE:*/
- int yplane_size = (height + 2 * border) * (width + 2 * border);
- int uvplane_size = ((1 + height) / 2 + border) * ((1 + width) / 2 + border);
-
if (ybf)
{
+ int y_stride = ((width + 2 * border) + 31) & ~31;
+ int yplane_size = (height + 2 * border) * y_stride;
+ /** There is currently a bunch of code which assumes
+ * uv_stride == y_stride/2, so enforce this here. */
+ int uv_width = width >> 1;
+ int uv_height = height >> 1;
+ int uv_stride = y_stride >> 1;
+ int uvplane_size = ((1 + height) / 2 + border) * uv_stride;
+
vp8_yv12_de_alloc_frame_buffer(ybf);
+ /** Only support allocating buffers that have a height and width that
+ * are multiples of 16, and a border that's a multiple of 32.
+ * The border restriction is required to get 16-byte alignment of the
+ * start of the chroma rows without intoducing an arbitrary gap
+ * between planes, which would break the semantics of things like
+ * vpx_img_set_rect(). */
+ if ((width & 0xf) | (height & 0xf) | (border & 0x1f))
+ return -3;
+
ybf->y_width = width;
ybf->y_height = height;
- ybf->y_stride = width + 2 * border;
+ ybf->y_stride = y_stride;
- ybf->uv_width = (1 + width) / 2;
- ybf->uv_height = (1 + height) / 2;
- ybf->uv_stride = ybf->uv_width + border;
+ ybf->uv_width = uv_width;
+ ybf->uv_height = uv_height;
+ ybf->uv_stride = uv_stride;
ybf->border = border;
ybf->frame_size = yplane_size + 2 * uvplane_size;
/* Added 2 extra lines to framebuffer so that copy12x12 doesn't fail
* when we have a large motion vector in V on the last v block.
* Note : We never use these pixels anyway so this doesn't hurt.
*/
- ybf->buffer_alloc = (unsigned char *) duck_memalign(32, ybf->frame_size + (ybf->y_stride * 2) + 32, 0);
+ ybf->buffer_alloc = (unsigned char *) vpx_memalign(32, ybf->frame_size);
if (ybf->buffer_alloc == NULL)
return -1;
- ybf->y_buffer = ybf->buffer_alloc + (border * ybf->y_stride) + border;
-
- if (yplane_size & 0xf)
- yplane_size += 16 - (yplane_size & 0xf);
-
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * ybf->uv_stride) + border / 2;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * ybf->uv_stride) + border / 2;
+ ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
+ ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
}
else
{
return -2;
}
return 0;
}

View File

@ -329,3 +329,6 @@ patch -p3 < bug646815.patch
# Patch to fix alignment problems with using ARM asm in Thumb mode.
patch -p3 < bug666931.patch
# Patch to make chroma planes 16-byte aligned.
patch -p3 < bug671818.patch

View File

@ -320,6 +320,36 @@ update_error_state(vpx_codec_alg_priv_t *ctx,
return res;
}
static void yuvconfig2image(vpx_image_t *img,
const YV12_BUFFER_CONFIG *yv12,
void *user_priv)
{
/** vpx_img_wrap() doesn't allow specifying independent strides for
* the Y, U, and V planes, nor other alignment adjustments that
* might be representable by a YV12_BUFFER_CONFIG, so we just
* initialize all the fields.*/
img->fmt = yv12->clrtype == REG_YUV ?
VPX_IMG_FMT_I420 : VPX_IMG_FMT_VPXI420;
img->w = yv12->y_stride;
img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
img->d_w = yv12->y_width;
img->d_h = yv12->y_height;
img->x_chroma_shift = 1;
img->y_chroma_shift = 1;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
img->planes[VPX_PLANE_U] = yv12->u_buffer;
img->planes[VPX_PLANE_V] = yv12->v_buffer;
img->planes[VPX_PLANE_ALPHA] = NULL;
img->stride[VPX_PLANE_Y] = yv12->y_stride;
img->stride[VPX_PLANE_U] = yv12->uv_stride;
img->stride[VPX_PLANE_V] = yv12->uv_stride;
img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
img->bps = 12;
img->user_priv = user_priv;
img->img_data = yv12->buffer_alloc;
img->img_data_owner = 0;
img->self_allocd = 0;
}
static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
const uint8_t *data,
@ -429,20 +459,8 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
if (!res && 0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, ppdeblocking, ppnoise, ppflag))
{
/* Align width/height */
unsigned int a_w = (sd.y_width + 15) & ~15;
unsigned int a_h = (sd.y_height + 15) & ~15;
vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
a_w + 2 * VP8BORDERINPIXELS,
a_h + 2 * VP8BORDERINPIXELS,
1,
sd.buffer_alloc);
vpx_img_set_rect(&ctx->img,
VP8BORDERINPIXELS, VP8BORDERINPIXELS,
sd.y_width, sd.y_height);
yuvconfig2image(&ctx->img, &sd, user_priv);
ctx->img_avail = 1;
}
}

View File

@ -47,20 +47,35 @@ vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int
{
/*NOTE:*/
int yplane_size = (height + 2 * border) * (width + 2 * border);
int uvplane_size = ((1 + height) / 2 + border) * ((1 + width) / 2 + border);
if (ybf)
{
int y_stride = ((width + 2 * border) + 31) & ~31;
int yplane_size = (height + 2 * border) * y_stride;
/** There is currently a bunch of code which assumes
* uv_stride == y_stride/2, so enforce this here. */
int uv_width = width >> 1;
int uv_height = height >> 1;
int uv_stride = y_stride >> 1;
int uvplane_size = ((1 + height) / 2 + border) * uv_stride;
vp8_yv12_de_alloc_frame_buffer(ybf);
/** Only support allocating buffers that have a height and width that
* are multiples of 16, and a border that's a multiple of 32.
* The border restriction is required to get 16-byte alignment of the
* start of the chroma rows without intoducing an arbitrary gap
* between planes, which would break the semantics of things like
* vpx_img_set_rect(). */
if ((width & 0xf) | (height & 0xf) | (border & 0x1f))
return -3;
ybf->y_width = width;
ybf->y_height = height;
ybf->y_stride = width + 2 * border;
ybf->y_stride = y_stride;
ybf->uv_width = (1 + width) / 2;
ybf->uv_height = (1 + height) / 2;
ybf->uv_stride = ybf->uv_width + border;
ybf->uv_width = uv_width;
ybf->uv_height = uv_height;
ybf->uv_stride = uv_stride;
ybf->border = border;
ybf->frame_size = yplane_size + 2 * uvplane_size;
@ -69,18 +84,14 @@ vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int
* when we have a large motion vector in V on the last v block.
* Note : We never use these pixels anyway so this doesn't hurt.
*/
ybf->buffer_alloc = (unsigned char *) duck_memalign(32, ybf->frame_size + (ybf->y_stride * 2) + 32, 0);
ybf->buffer_alloc = (unsigned char *) vpx_memalign(32, ybf->frame_size);
if (ybf->buffer_alloc == NULL)
return -1;
ybf->y_buffer = ybf->buffer_alloc + (border * ybf->y_stride) + border;
if (yplane_size & 0xf)
yplane_size += 16 - (yplane_size & 0xf);
ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * ybf->uv_stride) + border / 2;
ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * ybf->uv_stride) + border / 2;
ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
}
else
{

View File

@ -2591,10 +2591,10 @@ function importDialog(aParent, aSrc, aArguments) {
let dialog = null;
// we need to insert before menulist-container if we want it to show correctly
// for prompt.select for instance
let menulistContainer = document.getElementById("menulist-container");
let parentNode = menulistContainer.parentNode;
// we need to insert before context-container if we want allow pasting (using
// the context menu) into dialogs
let contentMenuContainer = document.getElementById("context-container");
let parentNode = contentMenuContainer.parentNode;
// emit DOMWillOpenModalDialog event
let event = document.createEvent("Events");
@ -2606,7 +2606,7 @@ function importDialog(aParent, aSrc, aArguments) {
let back = document.createElement("box");
back.setAttribute("class", "modal-block");
dialog = back.appendChild(document.importNode(doc, true));
parentNode.insertBefore(back, menulistContainer);
parentNode.insertBefore(back, contentMenuContainer);
dialog.arguments = aArguments;
dialog.parent = aParent;

View File

@ -452,11 +452,8 @@ RasterImage::GetType()
}
imgFrame*
RasterImage::GetImgFrame(PRUint32 framenum)
RasterImage::GetImgFrameNoDecode(PRUint32 framenum)
{
nsresult rv = WantDecodedFrames();
CONTAINER_ENSURE_TRUE(NS_SUCCEEDED(rv), nsnull);
if (!mAnim) {
NS_ASSERTION(framenum == 0, "Don't ask for a frame > 0 if we're not animated!");
return mFrames.SafeElementAt(0, nsnull);
@ -466,6 +463,14 @@ RasterImage::GetImgFrame(PRUint32 framenum)
return mFrames.SafeElementAt(framenum, nsnull);
}
imgFrame*
RasterImage::GetImgFrame(PRUint32 framenum)
{
nsresult rv = WantDecodedFrames();
CONTAINER_ENSURE_TRUE(NS_SUCCEEDED(rv), nsnull);
return GetImgFrameNoDecode(framenum);
}
imgFrame*
RasterImage::GetDrawableImgFrame(PRUint32 framenum)
{
@ -979,7 +984,7 @@ RasterImage::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
{
NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
imgFrame *frame = GetImgFrame(aFrameNum);
imgFrame *frame = GetImgFrameNoDecode(aFrameNum);
NS_ABORT_IF_FALSE(frame, "Calling FrameUpdated on frame that doesn't exist!");
frame->ImageUpdated(aUpdatedRect);
@ -2103,9 +2108,8 @@ RasterImage::CanDiscard() {
PRBool
RasterImage::CanForciblyDiscard() {
return (mDiscardable && // ...Enabled at creation time...
mHasSourceData && // ...have the source data...
mDecoded); // ...and have something to discard.
return mDiscardable && // ...Enabled at creation time...
mHasSourceData; // ...have the source data...
}
// Helper method to tell us whether the clock is currently running for
@ -2218,6 +2222,7 @@ RasterImage::ShutdownDecoder(eShutdownIntent aIntent)
// Kill off the worker
mWorker = nsnull;
mWorkerPending = PR_FALSE;
// We just shut down the decoder. If we didn't get what we want, but expected
// to, flag an error
@ -2539,7 +2544,22 @@ RasterImage::UnlockImage()
// Decrement our lock count
mLockCount--;
// We now _might_ have one of the qualifications for discarding. Re-evaluate.
// If we've decoded this image once before, we're currently decoding again,
// and our lock count is now zero (so nothing is forcing us to keep the
// decoded data around), try to cancel the decode and throw away whatever
// we've decoded.
if (mHasBeenDecoded && mDecoder &&
mLockCount == 0 && CanForciblyDiscard()) {
PR_LOG(gCompressedImageAccountingLog, PR_LOG_DEBUG,
("RasterImage[0x%p] canceling decode because image "
"is now unlocked.", this));
ShutdownDecoder(eShutdownIntent_Interrupted);
ForceDiscard();
return NS_OK;
}
// Otherwise, we might still be a candidate for discarding in the future. If
// we are, add ourselves to the discard tracker.
if (CanDiscard()) {
nsresult rv = DiscardTracker::Reset(&mDiscardTrackerNode);
CONTAINER_ENSURE_SUCCESS(rv);

View File

@ -375,6 +375,7 @@ private:
*/
void DeleteImgFrame(PRUint32 framenum);
imgFrame* GetImgFrameNoDecode(PRUint32 framenum);
imgFrame* GetImgFrame(PRUint32 framenum);
imgFrame* GetDrawableImgFrame(PRUint32 framenum);
imgFrame* GetCurrentImgFrame();

View File

@ -1107,6 +1107,44 @@ pref("intl.hyphenation-alias.en", "en-us");
// and for other subtags of en-*, if no specific patterns are available
pref("intl.hyphenation-alias.en-*", "en-us");
pref("intl.hyphenation-alias.af-*", "af");
pref("intl.hyphenation-alias.bg-*", "bg");
pref("intl.hyphenation-alias.ca-*", "ca");
pref("intl.hyphenation-alias.cy-*", "cy");
pref("intl.hyphenation-alias.da-*", "da");
pref("intl.hyphenation-alias.eo-*", "eo");
pref("intl.hyphenation-alias.es-*", "es");
pref("intl.hyphenation-alias.et-*", "et");
pref("intl.hyphenation-alias.gl-*", "gl");
pref("intl.hyphenation-alias.hr-*", "hr");
pref("intl.hyphenation-alias.hsb-*", "hsb");
pref("intl.hyphenation-alias.ia-*", "ia");
pref("intl.hyphenation-alias.is-*", "is");
pref("intl.hyphenation-alias.kmr-*", "kmr");
pref("intl.hyphenation-alias.la-*", "la");
pref("intl.hyphenation-alias.mn-*", "mn");
pref("intl.hyphenation-alias.nl-*", "nl");
pref("intl.hyphenation-alias.pt-*", "pt");
pref("intl.hyphenation-alias.sl-*", "sl");
pref("intl.hyphenation-alias.sv-*", "sv");
pref("intl.hyphenation-alias.uk-*", "uk");
// use reformed (1996) German patterns by default unless specifically tagged as de-1901
// (these prefs may soon be obsoleted by better BCP47-based tag matching, but for now...)
pref("intl.hyphenation-alias.de", "de-1996");
pref("intl.hyphenation-alias.de-*", "de-1996");
pref("intl.hyphenation-alias.de-DE-1901", "de-1901");
pref("intl.hyphenation-alias.de-CH-*", "de-CH");
// patterns from TeX are tagged as "sh" (Serbo-Croatian) macrolanguage;
// alias "sr" (Serbian) and "bs" (Bosnian) to those patterns
// (Croatian has its own separate patterns).
pref("intl.hyphenation-alias.sr", "sh");
pref("intl.hyphenation-alias.bs", "sh");
pref("intl.hyphenation-alias.sh-*", "sh");
pref("intl.hyphenation-alias.sr-*", "sh");
pref("intl.hyphenation-alias.bs-*", "sh");
pref("font.mathfont-family", "STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral, Asana Math, Standard Symbols L, DejaVu Sans, Cambria Math");
// Some CJK fonts have bad underline offset, their CJK character glyphs are overlapped (or adjoined) to its underline.

View File

@ -1273,6 +1273,8 @@ nsSocketTransport::RecoverFromError()
// try next ip address only if past the resolver stage...
if (mState == STATE_CONNECTING && mDNSRecord) {
mDNSRecord->ReportUnusable(SocketPort());
nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
if (NS_SUCCEEDED(rv)) {
SOCKET_LOG((" trying again with next ip address\n"));

View File

@ -41,6 +41,7 @@
#include "nsICharsetConverterManager.h"
#include "nsIServiceManager.h"
#define SNIFFING_BUFFER_SIZE 512 // specified in draft-abarth-mime-sniff-06
NS_IMETHODIMP
nsUnicharStreamLoader::Init(nsIUnicharStreamLoaderObserver *aObserver)
@ -49,7 +50,7 @@ nsUnicharStreamLoader::Init(nsIUnicharStreamLoaderObserver *aObserver)
mObserver = aObserver;
if (!mRawData.SetCapacity(512))
if (!mRawData.SetCapacity(SNIFFING_BUFFER_SIZE))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
@ -153,20 +154,21 @@ nsUnicharStreamLoader::OnDataAvailable(nsIRequest *aRequest,
PRUint32 dummy;
aInputStream->ReadSegments(WriteSegmentFun, this, aCount, &dummy);
} else {
// no decoder yet. Read up to 512 octets into mRawData (this is
// the cutoff specified in draft-abarth-mime-sniff-06). If we can
// get that much, then go ahead and fire charset detection and
// read the rest. Otherwise wait for more data.
// no decoder yet. Read up to SNIFFING_BUFFER_SIZE octets into
// mRawData (this is the cutoff specified in
// draft-abarth-mime-sniff-06). If we can get that much, then go
// ahead and fire charset detection and read the rest. Otherwise
// wait for more data.
PRUint32 haveRead = mRawData.Length();
PRUint32 toRead = 512 - haveRead;
PRUint32 toRead = NS_MIN(SNIFFING_BUFFER_SIZE - haveRead, aCount);
PRUint32 n;
char *here = mRawData.BeginWriting() + haveRead;
rv = aInputStream->Read(here, toRead, &n);
if (NS_SUCCEEDED(rv)) {
mRawData.SetLength(haveRead + n);
if (mRawData.Length() == 512) {
if (mRawData.Length() == SNIFFING_BUFFER_SIZE) {
rv = DetermineCharset();
if (NS_SUCCEEDED(rv)) {
// process what's left

View File

@ -80,6 +80,7 @@ public:
nsDNSRecord(nsHostRecord *hostRecord)
: mHostRecord(hostRecord)
, mIter(nsnull)
, mLastIter(nsnull)
, mIterGenCnt(-1)
, mDone(PR_FALSE) {}
@ -87,7 +88,9 @@ private:
virtual ~nsDNSRecord() {}
nsRefPtr<nsHostRecord> mHostRecord;
void *mIter;
void *mIter; // enum ptr for PR_EnumerateAddrInfo
void *mLastIter; // previous enum ptr, for use in
// getting addrinfo in ReportUnusable
int mIterGenCnt; // the generation count of
// mHostRecord->addr_info when we
// start iterating
@ -107,7 +110,7 @@ nsDNSRecord::GetCanonicalName(nsACString &result)
// host name is the IP address literal.
const char *cname;
{
MutexAutoLock lock(*mHostRecord->addr_info_lock);
MutexAutoLock lock(mHostRecord->addr_info_lock);
if (mHostRecord->addr_info)
cname = PR_GetCanonNameFromAddrInfo(mHostRecord->addr_info);
else
@ -126,7 +129,9 @@ nsDNSRecord::GetNextAddr(PRUint16 port, PRNetAddr *addr)
if (mDone)
return NS_ERROR_NOT_AVAILABLE;
mHostRecord->addr_info_lock->Lock();
mHostRecord->addr_info_lock.Lock();
PRBool startedFresh = !mIter;
if (mHostRecord->addr_info) {
if (!mIter)
mIterGenCnt = mHostRecord->addr_info_gencnt;
@ -135,16 +140,34 @@ nsDNSRecord::GetNextAddr(PRUint16 port, PRNetAddr *addr)
// Restart the iteration. Alternatively, we could just fail.
mIter = nsnull;
mIterGenCnt = mHostRecord->addr_info_gencnt;
startedFresh = PR_TRUE;
}
mIter = PR_EnumerateAddrInfo(mIter, mHostRecord->addr_info, port, addr);
mHostRecord->addr_info_lock->Unlock();
do {
mLastIter = mIter;
mIter = PR_EnumerateAddrInfo(mIter, mHostRecord->addr_info,
port, addr);
}
while (mIter && mHostRecord->Blacklisted(addr));
if (startedFresh && !mIter) {
// if everything was blacklisted we want to reset the blacklist (and
// likely relearn it) and return the first address. That is better
// than nothing
mHostRecord->ResetBlacklist();
mLastIter = nsnull;
mIter = PR_EnumerateAddrInfo(nsnull, mHostRecord->addr_info,
port, addr);
}
mHostRecord->addr_info_lock.Unlock();
if (!mIter) {
mDone = PR_TRUE;
return NS_ERROR_NOT_AVAILABLE;
}
}
else {
mHostRecord->addr_info_lock->Unlock();
mHostRecord->addr_info_lock.Unlock();
if (!mHostRecord->addr) {
// Both mHostRecord->addr_info and mHostRecord->addr are null.
// This can happen if mHostRecord->addr_info expired and the
@ -189,9 +212,11 @@ nsDNSRecord::HasMore(PRBool *result)
// unfortunately, NSPR does not provide a way for us to determine if
// there is another address other than to simply get the next address.
void *iterCopy = mIter;
void *iterLastCopy = mLastIter;
PRNetAddr addr;
*result = NS_SUCCEEDED(GetNextAddr(0, &addr));
mIter = iterCopy; // backup iterator
mLastIter = iterLastCopy; // backup iterator
mDone = PR_FALSE;
}
return NS_OK;
@ -201,11 +226,36 @@ NS_IMETHODIMP
nsDNSRecord::Rewind()
{
mIter = nsnull;
mLastIter = nsnull;
mIterGenCnt = -1;
mDone = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsDNSRecord::ReportUnusable(PRUint16 aPort)
{
// right now we don't use the port in the blacklist
mHostRecord->addr_info_lock.Lock();
// Check that we are using a real addr_info (as opposed to a single
// constant address), and that the generation count is valid. Otherwise,
// ignore the report.
if (mHostRecord->addr_info &&
mIterGenCnt == mHostRecord->addr_info_gencnt) {
PRNetAddr addr;
void *id = PR_EnumerateAddrInfo(mLastIter, mHostRecord->addr_info,
aPort, &addr);
if (id)
mHostRecord->ReportUnusable(&addr);
}
mHostRecord->addr_info_lock.Unlock();
return NS_OK;
}
//-----------------------------------------------------------------------------
class nsDNSAsyncRequest : public nsResolveHostCallback

Some files were not shown because too many files have changed in this diff Show More