mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central into mozilla-inbound
This commit is contained in:
commit
09cf2b47a9
@ -68,6 +68,7 @@
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
NS_IMETHODIMP nsPlaintextEditor::PrepareTransferable(nsITransferable **transferable)
|
||||
{
|
||||
@ -136,6 +137,10 @@ NS_IMETHODIMP nsPlaintextEditor::InsertTextFromTransferable(nsITransferable *aTr
|
||||
nsAutoString stuffToPaste;
|
||||
textDataObj->GetData(stuffToPaste);
|
||||
NS_ASSERTION(stuffToPaste.Length() <= (len/2), "Invalid length!");
|
||||
|
||||
// Sanitize possible carriage returns in the string to be inserted
|
||||
nsContentUtils::PlatformToDOMLineBreaks(stuffToPaste);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
rv = InsertTextAt(stuffToPaste, aDestinationNode, aDestOffset, aDoDeleteSelection);
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ _TEST_FILES = \
|
||||
test_bug638596.html \
|
||||
test_bug641466.html \
|
||||
test_bug645914.html \
|
||||
test_bug681229.html \
|
||||
$(NULL)
|
||||
|
||||
# disables the key handling test on gtk2 because gtk2 overrides some key events
|
||||
|
51
editor/libeditor/text/tests/test_bug681229.html
Normal file
51
editor/libeditor/text/tests/test_bug681229.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=681229
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 681229</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.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=681229">Mozilla Bug 681229</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<textarea spellcheck="false"></textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 681229 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var t = document.querySelector("textarea");
|
||||
t.focus();
|
||||
|
||||
const kValue = "a\r\nb";
|
||||
const kExpectedValue = (navigator.platform.indexOf("Win") == 0) ?
|
||||
"a\nb" : kValue;
|
||||
|
||||
SimpleTest.waitForClipboard(kExpectedValue,
|
||||
function() {
|
||||
SpecialPowers.copyString(kValue);
|
||||
},
|
||||
function() {
|
||||
synthesizeKey("V", {accelKey: true});
|
||||
is(t.value, "a\nb", "The carriage return has been correctly sanitized");
|
||||
SimpleTest.finish();
|
||||
},
|
||||
function() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -863,10 +863,25 @@ public class GeckoAppShell
|
||||
getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
Context context = GeckoApp.surfaceView.getContext();
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String text = null;
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
android.content.ClipboardManager cm = (android.content.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (cm.hasPrimaryClip()) {
|
||||
ClipData clip = cm.getPrimaryClip();
|
||||
if (clip != null) {
|
||||
ClipData.Item item = clip.getItemAt(0);
|
||||
text = item.coerceToText(context).toString();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (cm.hasText())
|
||||
text = cm.getText().toString();
|
||||
}
|
||||
try {
|
||||
sClipboardQueue.put(cm.hasText() ? cm.getText().toString() : "");
|
||||
sClipboardQueue.put(text != null ? text : "");
|
||||
} catch (InterruptedException ie) {}
|
||||
}});
|
||||
try {
|
||||
@ -880,9 +895,15 @@ public class GeckoAppShell
|
||||
getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
Context context = GeckoApp.surfaceView.getContext();
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(text);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
android.content.ClipboardManager cm = (android.content.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText("Text", text));
|
||||
} else {
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager)
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(text);
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include "jsstr.h"
|
||||
#include "jsvector.h"
|
||||
|
||||
#include "vm/GlobalObject.h"
|
||||
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsinterpinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
@ -65,9 +67,7 @@ using namespace js::types;
|
||||
|
||||
Class js::BooleanClass = {
|
||||
"Boolean",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(1) |
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean),
|
||||
JS_PropertyStub, /* addProperty */
|
||||
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean), JS_PropertyStub, /* addProperty */
|
||||
JS_PropertyStub, /* delProperty */
|
||||
JS_PropertyStub, /* getProperty */
|
||||
JS_StrictPropertyStub, /* setProperty */
|
||||
@ -152,12 +152,30 @@ Boolean(JSContext *cx, uintN argc, Value *vp)
|
||||
JSObject *
|
||||
js_InitBooleanClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto = js_InitClass(cx, obj, NULL, &BooleanClass, Boolean, 1,
|
||||
NULL, boolean_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
GlobalObject *global = obj->asGlobal();
|
||||
|
||||
JSObject *booleanProto = global->createBlankPrototype(cx, &BooleanClass);
|
||||
if (!booleanProto)
|
||||
return NULL;
|
||||
proto->setPrimitiveThis(BooleanValue(false));
|
||||
return proto;
|
||||
booleanProto->setPrimitiveThis(BooleanValue(false));
|
||||
|
||||
JSFunction *ctor = global->createConstructor(cx, Boolean, &BooleanClass,
|
||||
CLASS_ATOM(cx, Boolean), 1);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, booleanProto))
|
||||
return NULL;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, booleanProto, NULL, boolean_methods))
|
||||
return NULL;
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Boolean, ctor, booleanProto))
|
||||
return NULL;
|
||||
|
||||
return booleanProto;
|
||||
}
|
||||
|
||||
JSString *
|
||||
|
@ -72,6 +72,8 @@
|
||||
#include "jsstr.h"
|
||||
#include "jslibmath.h"
|
||||
|
||||
#include "vm/GlobalObject.h"
|
||||
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
@ -2605,34 +2607,52 @@ js_Date(JSContext *cx, uintN argc, Value *vp)
|
||||
JSObject *
|
||||
js_InitDateClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
/* set static LocalTZA */
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
/* Set the static LocalTZA. */
|
||||
LocalTZA = -(PRMJ_LocalGMTDifference() * msPerSecond);
|
||||
JSObject *proto = js_InitClass(cx, obj, NULL, &DateClass, js_Date, MAXARGS,
|
||||
NULL, date_methods, NULL, date_static_methods);
|
||||
if (!proto)
|
||||
|
||||
GlobalObject *global = obj->asGlobal();
|
||||
|
||||
JSObject *dateProto = global->createBlankPrototype(cx, &DateClass);
|
||||
if (!dateProto)
|
||||
return NULL;
|
||||
SetDateToNaN(cx, dateProto);
|
||||
|
||||
JSFunction *ctor = global->createConstructor(cx, js_Date, &DateClass,
|
||||
CLASS_ATOM(cx, Date), MAXARGS);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
|
||||
AutoObjectRooter tvr(cx, proto);
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, dateProto))
|
||||
return NULL;
|
||||
|
||||
SetDateToNaN(cx, proto);
|
||||
if (!DefinePropertiesAndBrand(cx, ctor, NULL, date_static_methods))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* ES5 B.2.6:
|
||||
* The Function object that is the initial value of
|
||||
* Date.prototype.toGMTString is the same Function
|
||||
* object that is the initial value of
|
||||
* Date.prototype.toUTCString.
|
||||
* Define all Date.prototype.* functions, then brand for trace-jitted code.
|
||||
* Date.prototype.toGMTString has the same initial value as
|
||||
* Date.prototype.toUTCString.
|
||||
*/
|
||||
AutoValueRooter toUTCStringFun(cx);
|
||||
if (!JS_DefineFunctions(cx, dateProto, date_methods))
|
||||
return NULL;
|
||||
Value toUTCStringFun;
|
||||
jsid toUTCStringId = ATOM_TO_JSID(cx->runtime->atomState.toUTCStringAtom);
|
||||
jsid toGMTStringId = ATOM_TO_JSID(cx->runtime->atomState.toGMTStringAtom);
|
||||
if (!js_GetProperty(cx, proto, toUTCStringId, toUTCStringFun.addr()) ||
|
||||
!js_DefineProperty(cx, proto, toGMTStringId, toUTCStringFun.addr(),
|
||||
JS_PropertyStub, JS_StrictPropertyStub, 0)) {
|
||||
if (!js_GetProperty(cx, dateProto, toUTCStringId, &toUTCStringFun) ||
|
||||
!js_DefineProperty(cx, dateProto, toGMTStringId, &toUTCStringFun,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, 0))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (!cx->typeInferenceEnabled())
|
||||
dateProto->brand(cx);
|
||||
|
||||
return proto;
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Date, ctor, dateProto))
|
||||
return NULL;
|
||||
|
||||
return dateProto;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
|
@ -75,6 +75,8 @@
|
||||
#include "jsvector.h"
|
||||
#include "jslibmath.h"
|
||||
|
||||
#include "vm/GlobalObject.h"
|
||||
|
||||
#include "jsatominlines.h"
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsinterpinlines.h"
|
||||
@ -82,6 +84,7 @@
|
||||
#include "jsobjinlines.h"
|
||||
#include "jsstrinlines.h"
|
||||
|
||||
#include "vm/NumberObject-inl.h"
|
||||
#include "vm/String-inl.h"
|
||||
|
||||
using namespace js;
|
||||
@ -1099,39 +1102,52 @@ FinishRuntimeNumberState(JSRuntime *rt)
|
||||
JSObject *
|
||||
js_InitNumberClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto, *ctor;
|
||||
JSRuntime *rt;
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
/* XXX must do at least once per new thread, so do it per JSContext... */
|
||||
FIX_FPU();
|
||||
|
||||
proto = js_InitClass(cx, obj, NULL, &NumberClass, Number, 1,
|
||||
NULL, number_methods, NULL, NULL);
|
||||
if (!proto || !(ctor = JS_GetConstructor(cx, proto)))
|
||||
return NULL;
|
||||
proto->setPrimitiveThis(Int32Value(0));
|
||||
GlobalObject *global = obj->asGlobal();
|
||||
|
||||
if (!JS_DefineFunctions(cx, obj, number_functions))
|
||||
JSObject *numberProto = global->createBlankPrototype(cx, &NumberClass);
|
||||
if (!numberProto)
|
||||
return NULL;
|
||||
numberProto->asNumber()->setPrimitiveValue(0);
|
||||
|
||||
JSFunction *ctor = global->createConstructor(cx, Number, &NumberClass,
|
||||
CLASS_ATOM(cx, Number), 1);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, numberProto))
|
||||
return NULL;
|
||||
|
||||
/* Add numeric constants (MAX_VALUE, NaN, &c.) to the Number constructor. */
|
||||
if (!JS_DefineConstDoubles(cx, ctor, number_constants))
|
||||
return NULL;
|
||||
|
||||
/* ECMA 15.1.1.1 */
|
||||
rt = cx->runtime;
|
||||
if (!JS_DefineProperty(cx, obj, js_NaN_str, rt->NaNValue,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||
if (!DefinePropertiesAndBrand(cx, numberProto, NULL, number_methods))
|
||||
return NULL;
|
||||
|
||||
if (!JS_DefineFunctions(cx, global, number_functions))
|
||||
return NULL;
|
||||
|
||||
/* ES5 15.1.1.1, 15.1.1.2 */
|
||||
if (!DefineNativeProperty(cx, global, ATOM_TO_JSID(cx->runtime->atomState.NaNAtom),
|
||||
cx->runtime->NaNValue, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0) ||
|
||||
!DefineNativeProperty(cx, global, ATOM_TO_JSID(cx->runtime->atomState.InfinityAtom),
|
||||
cx->runtime->positiveInfinityValue,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY, 0, 0))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ECMA 15.1.1.2 */
|
||||
if (!JS_DefineProperty(cx, obj, js_Infinity_str, rt->positiveInfinityValue,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Number, ctor, numberProto))
|
||||
return NULL;
|
||||
}
|
||||
return proto;
|
||||
|
||||
return numberProto;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include "jsscriptinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
#include "vm/NumberObject-inl.h"
|
||||
#include "vm/StringObject-inl.h"
|
||||
|
||||
#if JS_HAS_GENERATORS
|
||||
@ -6763,10 +6764,11 @@ PrimitiveToObject(JSContext *cx, const Value &v)
|
||||
{
|
||||
if (v.isString())
|
||||
return StringObject::create(cx, v.toString());
|
||||
if (v.isNumber())
|
||||
return NumberObject::create(cx, v.toNumber());
|
||||
|
||||
JS_ASSERT(v.isNumber() || v.isBoolean());
|
||||
Class *clasp = v.isNumber() ? &NumberClass : &BooleanClass;
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, clasp);
|
||||
JS_ASSERT(v.isBoolean());
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, &BooleanClass);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
|
||||
|
@ -380,6 +380,7 @@ extern Class XMLFilterClass;
|
||||
class ArgumentsObject;
|
||||
class GlobalObject;
|
||||
class NormalArgumentsObject;
|
||||
class NumberObject;
|
||||
class StrictArgumentsObject;
|
||||
class StringObject;
|
||||
|
||||
@ -1052,6 +1053,7 @@ struct JSObject : js::gc::Cell {
|
||||
}
|
||||
|
||||
public:
|
||||
inline js::NumberObject *asNumber();
|
||||
inline js::StringObject *asString();
|
||||
|
||||
/*
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include "jsgcmark.h"
|
||||
#include "jsweakmap.h"
|
||||
|
||||
#include "vm/GlobalObject.h"
|
||||
|
||||
#include "jsgcinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
@ -290,12 +292,27 @@ static JSFunctionSpec weak_map_methods[] = {
|
||||
JSObject *
|
||||
js_InitWeakMapClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto = js_InitClass(cx, obj, NULL, &WeakMapClass, WeakMap_construct, 0,
|
||||
NULL, weak_map_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
GlobalObject *global = obj->asGlobal();
|
||||
|
||||
JSObject *weakMapProto = global->createBlankPrototype(cx, &WeakMapClass);
|
||||
if (!weakMapProto)
|
||||
return NULL;
|
||||
weakMapProto->setPrivate(NULL);
|
||||
|
||||
JSFunction *ctor = global->createConstructor(cx, WeakMap_construct, &WeakMapClass,
|
||||
CLASS_ATOM(cx, WeakMap), 0);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
|
||||
proto->setPrivate(NULL);
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, weakMapProto))
|
||||
return NULL;
|
||||
|
||||
return proto;
|
||||
if (!DefinePropertiesAndBrand(cx, weakMapProto, NULL, weak_map_methods))
|
||||
return NULL;
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_WeakMap, ctor, weakMapProto))
|
||||
return NULL;
|
||||
return weakMapProto;
|
||||
}
|
||||
|
80
js/src/vm/NumberObject-inl.h
Normal file
80
js/src/vm/NumberObject-inl.h
Normal file
@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=78:
|
||||
*
|
||||
* ***** 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 SpiderMonkey string object code.
|
||||
*
|
||||
* 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):
|
||||
* Jeff Walden <jwalden+code@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#ifndef NumberObject_inl_h___
|
||||
#define NumberObject_inl_h___
|
||||
|
||||
#include "NumberObject.h"
|
||||
|
||||
inline js::NumberObject *
|
||||
JSObject::asNumber()
|
||||
{
|
||||
JS_ASSERT(isNumber());
|
||||
return static_cast<js::NumberObject *>(const_cast<JSObject *>(this));
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
inline NumberObject *
|
||||
NumberObject::create(JSContext *cx, jsdouble d)
|
||||
{
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, &NumberClass);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
NumberObject *numobj = obj->asNumber();
|
||||
numobj->setPrimitiveValue(d);
|
||||
return numobj;
|
||||
}
|
||||
|
||||
inline NumberObject *
|
||||
NumberObject::createWithProto(JSContext *cx, jsdouble d, JSObject &proto)
|
||||
{
|
||||
JSObject *obj = NewObjectWithClassProto(cx, &NumberClass, &proto,
|
||||
gc::GetGCObjectKind(RESERVED_SLOTS));
|
||||
if (!obj)
|
||||
return NULL;
|
||||
NumberObject *numobj = obj->asNumber();
|
||||
numobj->setPrimitiveValue(d);
|
||||
return numobj;
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif /* NumberObject_inl_h__ */
|
89
js/src/vm/NumberObject.h
Normal file
89
js/src/vm/NumberObject.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=78:
|
||||
*
|
||||
* ***** 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 SpiderMonkey string object code.
|
||||
*
|
||||
* 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):
|
||||
* Jeff Walden <jwalden+code@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#ifndef NumberObject_h___
|
||||
#define NumberObject_h___
|
||||
|
||||
#include "jsnum.h"
|
||||
|
||||
namespace js {
|
||||
|
||||
class NumberObject : public ::JSObject
|
||||
{
|
||||
/* Stores this Number object's [[PrimitiveValue]]. */
|
||||
static const uintN PRIMITIVE_VALUE_SLOT = 0;
|
||||
|
||||
public:
|
||||
static const uintN RESERVED_SLOTS = 1;
|
||||
|
||||
/*
|
||||
* Creates a new Number object boxing the given number. The object's
|
||||
* [[Prototype]] is determined from context.
|
||||
*/
|
||||
static inline NumberObject *create(JSContext *cx, jsdouble d);
|
||||
|
||||
/*
|
||||
* Identical to create(), but uses |proto| as [[Prototype]]. This method
|
||||
* must not be used to create |Number.prototype|.
|
||||
*/
|
||||
static inline NumberObject *createWithProto(JSContext *cx, jsdouble d, JSObject &proto);
|
||||
|
||||
Value unbox() const {
|
||||
JS_ASSERT(getSlot(PRIMITIVE_VALUE_SLOT).isNumber());
|
||||
return getSlot(PRIMITIVE_VALUE_SLOT);
|
||||
}
|
||||
|
||||
private:
|
||||
inline void setPrimitiveValue(jsdouble d) {
|
||||
setSlot(PRIMITIVE_VALUE_SLOT, NumberValue(d));
|
||||
}
|
||||
|
||||
/* For access to init, as Number.prototype is special. */
|
||||
friend JSObject *
|
||||
::js_InitNumberClass(JSContext *cx, JSObject *global);
|
||||
|
||||
private:
|
||||
NumberObject();
|
||||
NumberObject &operator=(const NumberObject &so);
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif /* NumberObject_h__ */
|
@ -38,8 +38,6 @@ let EXPORTED_SYMBOLS = ["Contacts"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
|
||||
let Contacts = {
|
||||
_providers: [],
|
||||
_contacts: [],
|
||||
@ -88,6 +86,7 @@ let Contacts = {
|
||||
#ifndef ANDROID
|
||||
#ifndef XP_MACOSX
|
||||
#ifdef XP_UNIX
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
Cu.import("resource:///modules/linuxTypes.jsm");
|
||||
|
||||
function EBookProvider() {
|
||||
|
@ -377,8 +377,9 @@ toolbarbutton.urlbar-button {
|
||||
color: @color_text_toolbutton_inverse@;
|
||||
display: -moz-box;
|
||||
font-size: @font_small@ !important;
|
||||
-moz-transform: translateY(-0.56em);
|
||||
-moz-padding-end: 33px; /* correct position and alignment */
|
||||
font-weight: bold !important;
|
||||
-moz-transform: translateY(-0.50em);
|
||||
-moz-padding-end: 32px; /* correct position and alignment */
|
||||
}
|
||||
|
||||
#tool-menu {
|
||||
|
@ -418,6 +418,12 @@ SpecialPowers.prototype = {
|
||||
getDocumentURIObject: function(aDocument) {
|
||||
return aDocument.documentURIObject;
|
||||
},
|
||||
|
||||
copyString: function(str) {
|
||||
Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||
getService(Ci.nsIClipboardHelper).
|
||||
copyString(str);
|
||||
},
|
||||
};
|
||||
|
||||
// Expose everything but internal APIs (starting with underscores) to
|
||||
|
@ -279,13 +279,24 @@ function getReportersByProcess()
|
||||
var e = mgr.enumerateReporters();
|
||||
while (e.hasMoreElements()) {
|
||||
var rOrig = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
|
||||
addReporter(rOrig.process, rOrig.path, rOrig.kind, rOrig.units,
|
||||
rOrig.amount, rOrig.description);
|
||||
try {
|
||||
addReporter(rOrig.process, rOrig.path, rOrig.kind, rOrig.units,
|
||||
rOrig.amount, rOrig.description);
|
||||
}
|
||||
catch(e) {
|
||||
debug("An error occurred when collecting results from the memory reporter " +
|
||||
rOrig.path + ": " + e);
|
||||
}
|
||||
}
|
||||
var e = mgr.enumerateMultiReporters();
|
||||
while (e.hasMoreElements()) {
|
||||
var mrOrig = e.getNext().QueryInterface(Ci.nsIMemoryMultiReporter);
|
||||
mrOrig.collectReports(addReporter, null);
|
||||
try {
|
||||
mrOrig.collectReports(addReporter, null);
|
||||
}
|
||||
catch(e) {
|
||||
debug("An error occurred when collecting a multi-reporter's results: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
return reportersByProcess;
|
||||
@ -1073,4 +1084,3 @@ function debug(x)
|
||||
div.innerHTML = JSON.stringify(x);
|
||||
content.appendChild(div);
|
||||
}
|
||||
|
||||
|
@ -288,10 +288,18 @@ LoginManager.prototype = {
|
||||
// Only process things which might have HTML forms.
|
||||
if (!(domDoc instanceof Ci.nsIDOMHTMLDocument))
|
||||
return;
|
||||
|
||||
this._pwmgr.log("onStateChange accepted: req = " +
|
||||
(aRequest ? aRequest.name : "(null)") +
|
||||
", flags = 0x" + aStateFlags.toString(16));
|
||||
if (this._pwmgr._debug) {
|
||||
let requestName = "(null)";
|
||||
if (aRequest) {
|
||||
try {
|
||||
requestName = aRequest.name;
|
||||
} catch (ex if ex.result == Components.results.NS_ERROR_NOT_IMPLEMENTED) {
|
||||
// do nothing - leave requestName = "(null)"
|
||||
}
|
||||
}
|
||||
this._pwmgr.log("onStateChange accepted: req = " + requestName +
|
||||
", flags = 0x" + aStateFlags.toString(16));
|
||||
}
|
||||
|
||||
// Fastback doesn't fire DOMContentLoaded, so process forms now.
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) {
|
||||
|
@ -447,7 +447,8 @@ static void EndCrashReporterDialog(HWND hwndDlg, int code)
|
||||
{
|
||||
// Save the current values to the registry
|
||||
wchar_t email[MAX_EMAIL_LENGTH];
|
||||
GetDlgItemText(hwndDlg, IDC_EMAILTEXT, email, sizeof(email));
|
||||
GetDlgItemTextW(hwndDlg, IDC_EMAILTEXT, email,
|
||||
sizeof(email) / sizeof(email[0]));
|
||||
SetStringKey(gCrashReporterKey.c_str(), EMAIL_VALUE, email);
|
||||
|
||||
SetBoolKey(gCrashReporterKey.c_str(), INCLUDE_URL_VALUE,
|
||||
@ -590,7 +591,8 @@ static void UpdateEmail(HWND hwndDlg)
|
||||
{
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_EMAILMECHECK)) {
|
||||
wchar_t email[MAX_EMAIL_LENGTH];
|
||||
GetDlgItemText(hwndDlg, IDC_EMAILTEXT, email, sizeof(email));
|
||||
GetDlgItemTextW(hwndDlg, IDC_EMAILTEXT, email,
|
||||
sizeof(email) / sizeof(email[0]));
|
||||
gQueryParameters[L"Email"] = email;
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_SUBMITREPORTCHECK))
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_EMAILTEXT), true);
|
||||
@ -603,7 +605,8 @@ static void UpdateEmail(HWND hwndDlg)
|
||||
static void UpdateComment(HWND hwndDlg)
|
||||
{
|
||||
wchar_t comment[MAX_COMMENT_LENGTH + 1];
|
||||
GetDlgItemText(hwndDlg, IDC_COMMENTTEXT, comment, sizeof(comment));
|
||||
GetDlgItemTextW(hwndDlg, IDC_COMMENTTEXT, comment,
|
||||
sizeof(comment) / sizeof(comment[0]));
|
||||
if (wcslen(comment) > 0)
|
||||
gQueryParameters[L"Comments"] = comment;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user