Merge mozilla-central and inbound; CLOSED TREE

--HG--
extra : amend_source : af326b0eb24cafb5212fab43dcecacc5ddf0ee60
This commit is contained in:
Ed Morley 2014-03-07 15:07:22 +00:00
Родитель d61d42192c dfa404843f
Коммит 615a513f83
133 изменённых файлов: 2316 добавлений и 4043 удалений

Просмотреть файл

@ -3,9 +3,7 @@ support-files = zoom_tree.xul
[test_browser.html]
[test_canvas_hitregion.html]
# Disabled everywhere because of failures. It appears this test has
# never executed since its inception.
skip-if = true || (os == "android" || appname == "b2g")
skip-if = (os == "android" || appname == "b2g")
[test_general.html]
[test_menu.xul]
[test_zoom.html]

Просмотреть файл

@ -43,7 +43,7 @@
function doTest()
{
getNode("hittest").scrollIntoView(true);
getNode("hitcanvas").scrollIntoView(true);
var context = document.getElementById("hitcanvas").getContext('2d');
redrawCheckbox(context, document.getElementById('hitcheck'), 20, 40);

Просмотреть файл

@ -874,6 +874,14 @@ pref("apz.pan_repaint_interval", 16);
// to avoid checkerboarding. Note, float value must be set as a string.
pref("apz.max_velocity_pixels_per_ms", "6.0");
// Tweak default displayport values to reduce the risk of running out of
// memory when zooming in
pref("apz.x_skate_size_multiplier", "1.25");
pref("apz.y_skate_size_multiplier", "1.5");
pref("apz.x_stationary_size_multiplier", "1.5");
pref("apz.y_stationary_size_multiplier", "1.8");
pref("apz.enlarge_displayport_when_clipped", true);
// This preference allows FirefoxOS apps (and content, I think) to force
// the use of software (instead of hardware accelerated) 2D canvases by
// creating a context like this:

Просмотреть файл

@ -95,14 +95,8 @@
"movistar.com.ve": "\\(Mobile#(Android; Mobile",
// bug 828445, bumeran.com.ve
"bumeran.com.ve": "\\(Mobile#(Android; Mobile",
// bug 843112, movil.bankinter.es
"movil.bankinter.es": "\\(Mobile#(Android; Mobile",
// bug 843114, einforma.com
"einforma.com": "\\(Mobile#(Android; Mobile",
// bug 843119, askthebuilder.com
"askthebuilder.com": "\\(Mobile#(Android; Mobile",
// bug 843121, tor.com
"tor.com": "\\(Mobile#(Android; Mobile",
// bug 843126, es.playstation.com
"es.playstation.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
// bug 843129, 11870.com
@ -111,10 +105,6 @@
"iphonejuegosgratis.com": "\\(Mobile#(Android; Mobile",
// bug 843132, comunio.es
"comunio.es": "\\(Mobile#(Android; Mobile",
// bug 843139, consumersearch.com
"consumersearch.com": "\\(Mobile#(Android; Mobile",
// bug 843141, foodily.com
"foodily.com": "\\(Mobile#(Android; Mobile",
// bug 843151, citibank.com
"citibank.com": "\\(Mobile#(Android; Mobile",
// bug 843153, games.com
@ -125,8 +115,6 @@
"virginatlantic.com": "\\(Mobile#(Android; Mobile",
// bug 843172, zimbio.com
"zimbio.com": "\\(Mobile#(Android; Mobile",
// bug 843178, txt2nite.com
"txt2nite.com": "\\(Mobile#(Android; Mobile",
// bug 843181, slashgear.com
"slashgear.com": "\\(Mobile#(Android; Mobile",
// bug 843186, chevrolet.com

Просмотреть файл

@ -766,17 +766,10 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
thebesImageSurface->CopyToB8G8R8A8DataSourceSurface();
NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
DataSourceSurface::MappedSurface map;
dataSurface->Map(DataSourceSurface::MapType::READ, &map);
if (!map.mData) {
return NS_ERROR_FAILURE;
}
int32_t width = dataSurface->GetSize().width;
int32_t height = dataSurface->GetSize().height;
int32_t bytesPerPixel = 4 * sizeof(uint8_t);
uint32_t bytesPerRow = bytesPerPixel * width;
uint32_t length = map.mStride * height;
// initialize these bitmap structs which we will later
// serialize directly to the head of the bitmap file
@ -805,6 +798,11 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
rv = NS_NewLocalFileOutputStream(getter_AddRefs(stream), aFile);
NS_ENSURE_SUCCESS(rv, rv);
DataSourceSurface::MappedSurface map;
if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
return NS_ERROR_FAILURE;
}
// write the bitmap headers and rgb pixel data to the file
rv = NS_ERROR_FAILURE;
if (stream) {
@ -815,7 +813,7 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
if (written == sizeof(BITMAPINFOHEADER)) {
// write out the image data backwards because the desktop won't
// show bitmaps with negative heights for top-to-bottom
uint32_t i = length;
uint32_t i = map.mStride * height;
do {
i -= map.mStride;
stream->Write(((const char*)map.mData) + i, bytesPerRow, &written);
@ -832,6 +830,8 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
stream->Close();
}
dataSurface->Unmap();
return rv;
}

Просмотреть файл

@ -3935,7 +3935,7 @@ MOZ_PAY=
MOZ_AUDIO_CHANNEL_MANAGER=
NSS_NO_LIBPKIX=
MOZ_CONTENT_SANDBOX=
MOZ_CONTENT_SANDBOX_REPORTER=
MOZ_CONTENT_SANDBOX_REPORTER=1
JSGC_USE_EXACT_ROOTING=
case "$target_os" in
@ -8005,7 +8005,7 @@ if test "$MOZ_ENABLE_SKIA"; then
AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
fi
if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64"; then
if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
MOZ_ENABLE_SKIA_GPU=1
AC_DEFINE(USE_SKIA_GPU)
AC_SUBST(MOZ_ENABLE_SKIA_GPU)

Просмотреть файл

@ -181,7 +181,6 @@
#include "nsXULAppAPI.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchEvent.h"
#include "DictionaryHelpers.h"
#include "GeneratedEvents.h"
#include "mozilla/Preferences.h"

Просмотреть файл

@ -29,10 +29,3 @@ interface nsIDOMSpeechRecognitionEvent : nsIDOMEvent {
readonly attribute DOMString interpretation;
readonly attribute nsIDOMDocument emma;
};
dictionary SpeechRecognitionEventInit : EventInit {
unsigned long resultIndex;
nsISupports results;
DOMString interpretation;
nsIDOMDocument emma;
};

Просмотреть файл

@ -25,9 +25,3 @@ interface nsIDOMSpeechSynthesisEvent : nsIDOMEvent {
readonly attribute float elapsedTime;
readonly attribute DOMString name;
};
dictionary SpeechSynthesisEventInit : EventInit {
unsigned long charIndex;
float elapsedTime;
DOMString name;
};

Просмотреть файл

@ -42,6 +42,12 @@ DEFINES['SQLITE_DEFAULT_PAGE_SIZE'] = 32768
DEFINES['SQLITE_MAX_DEFAULT_PAGE_SIZE'] = 32768
DEFINES['SQLITE_MAX_SCHEMA_RETRY'] = 25
# -DSQLITE_WIN32_GETVERSIONEX=0 avoids using deprecated functions.
# SQLite will just assume we are running on NT kinds of Windows. That's fine
# because we don't support Win9x.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SQLITE_WIN32_GETVERSIONEX'] = 0
# -DSQLITE_ENABLE_LOCKING_STYLE=1 to help with AFP folders
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
DEFINES['SQLITE_ENABLE_LOCKING_STYLE'] = 1

Просмотреть файл

@ -721,19 +721,8 @@ static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
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";
#endif
static const char js_typeinfer_content_str[] = JS_OPTIONS_DOT_STR "typeinference.content";
static const char js_typeinfer_chrome_str[] = JS_OPTIONS_DOT_STR "typeinference.chrome";
static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify";
static const char js_asmjs_content_str[] = JS_OPTIONS_DOT_STR "asmjs";
static const char js_baselinejit_content_str[] = JS_OPTIONS_DOT_STR "baselinejit.content";
static const char js_baselinejit_chrome_str[] = JS_OPTIONS_DOT_STR "baselinejit.chrome";
static const char js_baselinejit_eager_str[] = JS_OPTIONS_DOT_STR "baselinejit.unsafe_eager_compilation";
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
static const char js_ion_chrome_str[] = JS_OPTIONS_DOT_STR "ion.chrome";
static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_eager_compilation";
static const char js_parallel_parsing_str[] = JS_OPTIONS_DOT_STR "parallel_parsing";
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
void
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
@ -756,39 +745,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global));
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
bool useTypeInference = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_typeinfer_chrome_str :
js_typeinfer_content_str);
bool useBaselineJIT = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_baselinejit_chrome_str :
js_baselinejit_content_str);
bool useBaselineJITEager = Preferences::GetBool(js_baselinejit_eager_str);
bool useIon = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_ion_chrome_str :
js_ion_content_str);
bool useIonEager = Preferences::GetBool(js_ion_eager_str);
bool useAsmJS = Preferences::GetBool(js_asmjs_content_str);
bool parallelParsing = Preferences::GetBool(js_parallel_parsing_str);
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
bool safeMode = false;
xr->GetInSafeMode(&safeMode);
if (safeMode) {
useTypeInference = false;
useBaselineJIT = false;
useBaselineJITEager = false;
useIon = false;
useIonEager = false;
useAsmJS = false;
}
}
JS::ContextOptionsRef(cx).setTypeInference(useTypeInference)
.setBaseline(useBaselineJIT)
.setIon(useIon)
.setAsmJS(useAsmJS);
#ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if
// javascript.options.strict.debug is true
@ -800,15 +756,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
JS::ContextOptionsRef(cx).setWerror(Preferences::GetBool(js_werror_option_str));
::JS_SetParallelParsingEnabled(context->mContext, parallelParsing);
::JS_SetParallelIonCompilationEnabled(context->mContext, parallelIonCompilation);
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_BASELINE_USECOUNT_TRIGGER,
(useBaselineJITEager ? 0 : -1));
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_ION_USECOUNT_TRIGGER,
(useIonEager ? 0 : -1));
#ifdef JS_GC_ZEAL
int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1);
int32_t frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);

Просмотреть файл

@ -24,7 +24,6 @@
#include "DOMCameraManager.h"
#include "DOMCameraCapabilities.h"
#include "CameraCommon.h"
#include "DictionaryHelpers.h"
#include "nsGlobalWindow.h"
#include "CameraPreviewMediaStream.h"
#include "mozilla/dom/CameraControlBinding.h"
@ -34,7 +33,6 @@
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::idl;
using namespace mozilla::ipc;
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl)

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsIPermissionManager.h"
#include "DOMCameraControl.h"
#include "nsDOMClassInfo.h"
#include "DictionaryHelpers.h"
#include "CameraCommon.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/CameraManagerBinding.h"

Просмотреть файл

@ -17,9 +17,3 @@ interface nsIDOMMozCellBroadcastEvent : nsIDOMEvent
in boolean aCancelable,
in nsIDOMMozCellBroadcastMessage aMessage);
};
dictionary MozCellBroadcastEventInit : EventInit
{
//[binaryname(MessageMoz)]
nsIDOMMozCellBroadcastMessage message;
};

Просмотреть файл

@ -37,7 +37,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsIPrincipal.h"
#include "nsJSUtils.h"
#include "DictionaryHelpers.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsXULAppAPI.h"

Просмотреть файл

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # b2g-desktop(bug 979446, frequent failures)
support-files =
serve_file.sjs

Просмотреть файл

@ -13,8 +13,6 @@
#include "FileCommon.h"
#include "zipstruct.h"
#include "DictionaryHelpers.h"
BEGIN_FILE_NAMESPACE
/**

Просмотреть файл

@ -48,7 +48,8 @@ CreateDirectoryTask::CreateDirectoryTask(
CreateDirectoryTask::~CreateDirectoryTask()
{
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(!mPromise || NS_IsMainThread(),
"mPromise should be released on main thread!");
}
already_AddRefed<Promise>
@ -123,6 +124,7 @@ CreateDirectoryTask::HandlerCallback()
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
if (!filesystem) {
mPromise = nullptr;
return;
}
@ -130,10 +132,12 @@ CreateDirectoryTask::HandlerCallback()
nsRefPtr<DOMError> domError = new DOMError(filesystem->GetWindow(),
mErrorValue);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}
nsRefPtr<Directory> dir = new Directory(filesystem, mTargetRealPath);
mPromise->MaybeResolve(dir);
mPromise = nullptr;
}
void

Просмотреть файл

@ -53,7 +53,8 @@ GetFileOrDirectoryTask::GetFileOrDirectoryTask(
GetFileOrDirectoryTask::~GetFileOrDirectoryTask()
{
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
MOZ_ASSERT(!mPromise || NS_IsMainThread(),
"mPromise should be released on main thread!");
}
already_AddRefed<Promise>
@ -197,6 +198,7 @@ GetFileOrDirectoryTask::HandlerCallback()
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
if (!filesystem) {
mPromise = nullptr;
return;
}
@ -204,16 +206,19 @@ GetFileOrDirectoryTask::HandlerCallback()
nsRefPtr<DOMError> domError = new DOMError(filesystem->GetWindow(),
mErrorValue);
mPromise->MaybeReject(domError);
mPromise = nullptr;
return;
}
if (mIsDirectory) {
nsRefPtr<Directory> dir = new Directory(filesystem, mTargetRealPath);
mPromise->MaybeResolve(dir);
mPromise = nullptr;
return;
}
mPromise->MaybeResolve(mTargetFile);
mPromise = nullptr;
}
void

Просмотреть файл

@ -1,669 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
interface nsIDOMEvent;
dictionary MozStkTextMessage
{
/**
* Text String.
*
* @see TS 11.14, clause 12.15, Text String.
*/
DOMString text;
/**
* The length of time for which the ME shall display the dialog.
*
* @see MozStkDuration
*/
jsval duration;
/**
* Indicate this text message is high priority or normal priority.
*
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 1.
*
* High priority text shall be displayed on the screen immediately, except if
* there is a conflict of priority level of alerting such as incoming calls
* or a low battery warning. In that situation, the resolution is left to
* the terminal. If the command is rejected in spite of the high priority,
* the terminal shall inform the ICC with resultCode is
* TERMINAL_CRNTLY_UNABLE_TO_PROCESS in MozStkResponse.
*
* true: high priority
* false: normal priority
*/
boolean isHighPriority;
/**
* Need to wait for user to clear message or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 8.
*
* If this attribute is true, but user doesn't give any input within a period
* of time(said 30 secs), the terminal shall inform the ICC with resultCode
* is NO_RESPONSE_FROM_USER in MozStkResponse.
*
* true: Wait for user to clear message.
* false: clear message after a delay.
*/
boolean userClear;
/**
* Need to response immediately or not.
*
* @see TS 11.14, clause 12.43, Immediate response.
*
* When this attribute is true, the terminal shall immediately send
* MozStkResponse with resultCode is OK.
*
* true: The terminal shall send response immediately.
* false: otherwise.
*/
boolean responseNeeded;
};
dictionary MozStkItem
{
/**
* Identifier of item.
*
* The identifier is a single byte between '01' and 'FF'. Each item shall
* have a unique identifier within an Item list.
*/
unsigned short identifier;
/**
* Text string of item.
*/
DOMString text;
};
dictionary MozStkMenu
{
/**
* Array of MozStkItem.
*
* @see TS 11.14, clause 12.9
*/
jsval items; // MozStkItem[]
/**
* Presentation type, one of TYPE_*.
*/
unsigned short presentationType;
/**
* Title of the menu.
*/
DOMString title;
/**
* Default item identifier of the menu.
*/
unsigned short defaultItem;
/**
* Help information available or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, SET UP MENU, bit 8.
*
* true: help information available.
* false: no help information available.
*/
boolean isHelpAvailable;
/**
* List of Next Action Indicators.
* Each element should be one of nsIDOMMozIccManager.STK_CMD_*
* or nsIDOMMozIccManager.STK_NEXT_ACTION_*
* If it's STK_NEXT_ACTION_NULL, the terminal should ignore this action
* in corresponding item.
*
* @see TS 11.14, clause 12.24, Items Next Action Indicator.
*/
jsval nextActionList; // unsigned short []
};
dictionary MozStkInput
{
/**
* Text for the ME to display in conjunction with asking the user to respond.
*/
DOMString text;
/**
* The length of time for which the ME shall display the dialog. This field
* is used only for GET INKEY.
*
* @see TS 11.14, clause 11.8, duration, GET INKEY T.C 27.22.4.2.8.4.2
*/
jsval duration;
/**
* Minimum length of response.
*/
unsigned short minLength;
/**
* Maximum length of response.
*/
unsigned short maxLength;
/**
* Text for the ME to display, corresponds to a default text string offered
* by the ICC.
*/
DOMString defaultText;
/**
* Input format.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 1.
*
* true: Alphabet set.
* false: Digits only.
*/
boolean isAlphabet;
/**
* Alphabet encoding.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 2.
*
* true: UCS2 alphabet.
* false: default SMS alphabet.
*/
boolean isUCS2;
/**
* Visibility of input.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 3.
*
* true: User input shall not be revealed in any way.
* false: ME may echo user input on the display.
*/
boolean hideInput;
/**
* Yes/No response is requested.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INKEY, bit 3.
*
* true: Yes/No response is requested, and character sets
* (Alphabet set and UCS2) are disabled.
* false: Character sets (Alphabet set and UCS2) are enabled.
*/
boolean isYesNoRequested;
/**
* User input in packed or unpacked format.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 4.
*
* true: User input to be in SMS packed format.
* false: User input to be in unpacked format.
*/
boolean isPacked;
/**
* Help information available or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
*
* true: help information available.
* false: no help information available.
*/
boolean isHelpAvailable;
};
dictionary MozStkBrowserSetting
{
/**
* Confirm message to launch browser.
*
* @see MozStkTextMessage for the detail specification of
* confirmMessage.
*/
jsval confirmMessage;
/**
* The URL to be opened by browser.
*/
DOMString url;
/**
* One of STK_BROWSER_MODE_*.
*
* @see nsIDOMMozIccManager.STK_BROWSER_MODE_*
*/
unsigned short mode;
};
dictionary MozStkSetUpCall
{
/**
* The Dialling number.
*/
DOMString address;
/**
* The text message used in user confirmation phase.
*
* @see MozStkTextMessage for the detail specification of
* confirmMessage.
*/
jsval confirmMessage;
/**
* The text message used in call set up phase.
*
* @see MozStkTextMessage for the detail specification of
* callMessage.
*/
jsval callMessage;
/**
* The Optional maximum duration for the redial mechanism.
* The time elapsed since the first call set-up attempt has exceeded the duration
* requested by the UICC, the redial mechanism is terminated.
*/
jsval duration;
};
dictionary MozStkSetUpEventList
{
/**
* The list of events that needs to provide details to ICC when they happen.
* When this valus is null, means an indication to remove the existing list
* of events in ME.
*
* @see nsIDOMMozIccManager.STK_EVENT_TYPE_*
*/
jsval eventList; // unsigned short []
};
dictionary MozStkLocationInfo
{
/**
* Mobile Country Code (MCC) of the current serving operator.
*/
unsigned short mcc;
/**
* Mobile Network Code (MNC) of the current serving operator.
*/
unsigned short mnc;
/**
* Mobile Location Area Code (LAC) for the current serving operator.
*/
unsigned short gsmLocationAreaCode;
/**
* Mobile Cell ID for the current serving operator.
*/
unsigned long gsmCellId;
};
dictionary MozStkDuration
{
/**
* Time unit used, should be one of STK_TIME_UNIT_*.
*/
unsigned short timeUnit;
/**
* The length of time required, expressed in timeUnit.
*/
octet timeInterval;
};
dictionary MozStkPlayTone
{
/**
* Text String.
*/
DOMString text;
/**
* One of STK_TONE_TYPE_*.
*/
unsigned short tone;
/**
* The length of time for which the ME shall generate the tone.
*
* @see MozStkDuration
*/
jsval duration;
/**
* Need to vibrate or not.
* true: vibrate alert, if available, with the tone.
* false: use of vibrate alert is up to the ME.
*/
boolean isVibrate;
};
dictionary MozStkProvideLocalInfo
{
/**
* Indicate which local information is required.
* It shall be one of following:
* - nsIDOMMozIccManager.STK_LOCAL_INFO_LOCATION_INFO
* - nsIDOMMozIccManager.STK_LOCAL_INFO_IMEI
* - nsIDOMMozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE
* - nsIDOMMozIccManager.STK_LOCAL_INFO_LANGUAGE
*/
unsigned short localInfoType;
};
dictionary MozStkLocationEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_LOCATION_STATUS;
*/
unsigned short eventType;
/**
* Indicate current service state of the MS with one of the values listed
* below:
* - nsIDOMMozIccManager.STK_SERVICE_STATE_NORMAL
* - nsIDOMMozIccManager.STK_SERVICE_STATE_LIMITED
* - nsIDOMMozIccManager.STK_SERVICE_STATE_UNAVAILABLE
*/
unsigned short locationStatus;
/**
* See MozStkLocationInfo.
* This value shall only be provided if the locationStatus indicates
* 'STK_SERVICE_STATE_NORMAL'.
*/
jsval locationInfo;
};
dictionary MozStkTimer
{
/**
* Identifier of a timer.
*/
octet timerId;
/**
* Length of time during which the timer has to run.
* The resolution of a timer is 1 second.
*/
unsigned long timerValue;
/**
* The action requested from UICC.
* It shall be one of below:
* - nsIDOMMozIccManager.STK_TIMER_START
* - nsIDOMMozIccManager.STK_TIMER_DEACTIVATE
* - nsIDOMMozIccManager.STK_TIMER_GET_CURRENT_VALUE
*/
unsigned short timerAction;
};
dictionary MozStkBipMessage
{
/**
* Text String
*/
DOMString text;
};
dictionary MozStkCommand
{
/**
* The number of command issued by ICC. And it is assigned
* by ICC may take any hexadecimal value betweean '01' and 'FE'.
*
* @see TS 11.14, clause 6.5.1
*/
unsigned short commandNumber;
/**
* One of STK_CMD_*
*/
unsigned short typeOfCommand;
/**
* Qualifiers specific to the command.
*/
unsigned short commandQualifier;
/**
* options varies accrording to the typeOfCommand in MozStkCommand.
*
* When typeOfCommand is
* - STK_CMD_DISPLAY_TEXT
* - STK_CMD_SET_UP_IDLE_MODE_TEXT
* - STK_CMD_SEND_{SS|USSD|SMS|DTMF},
* options is MozStkTextMessage.
*
* When typeOfCommand is
* - STK_CMD_SELECT_ITEM
* - STK_CMD_SET_UP_MENU
* options is MozStkMenu.
*
* When typeOfCommand is
* - STK_CMD_GET_INKEY
* - STK_CMD_GET_INPUT,
* options is MozStkInput.
*
* When typeOfCommand is
* - STK_CMD_LAUNCH_BROWSER
* options is MozStkBrowserSetting.
*
* When typeOfCommand is
* - STK_CMD_SET_UP_CALL
* options is MozStkSetUpCall.
*
* When typeOfCommand is
* - STK_CMD_SET_UP_EVENT_LIST
* options is MozStkSetUpEventList.
*
* When typeOfCommand is
* - STK_CMD_PLAY_TONE
* options is MozStkPlayTone.
*
* When typeOfCommand is
* - STK_CMD_POLL_INTERVAL
* options is MozStkDuration.
*
* When typeOfCommand is
* - STK_CMD_PROVIDE_LOCAL_INFO
* options is MozStkProvideLocalInfo.
*
* When typeOfCommand is
* - STK_CMD_TIMER_MANAGEMENT
* option is MozStkTimer
*
* When typeOfCommand is
* - STK_CMD_OPEN_CHANNEL
* - STK_CMD_CLOSE_CHANNEL
* - STK_CMD_SEND_DATA
* - STK_CMD_RECEIVE_DATA
* options is MozStkBipMessage
*
* When typeOfCommand is
* - STK_CMD_POLL_OFF
* options is null.
*
* When typeOfCommand is
* - STK_CMD_REFRESH
* options is null.
*/
jsval options;
};
dictionary MozStkResponse
{
/**
* One of RESULT_*
*/
unsigned short resultCode;
/**
* The identifier of the item selected by user.
*
* @see MozStkItem.identifier
*/
unsigned short itemIdentifier;
/**
* User input.
*/
DOMString input;
/**
* YES/NO response.
*
* @see MozStkInput.isYesNoRequested
*/
boolean isYesNo;
/**
* User has confirmed or rejected the call during STK_CMD_CALL_SET_UP.
*
* @see RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
*
* true: Confirmed by User.
* false: Rejected by User.
*/
boolean hasConfirmed;
/**
* The response for STK_CMD_PROVIDE_LOCAL_INFO
*
* @see MozStkLocalInfo
*/
jsval localInfo;
/**
* The response for STK_CMD_TIMER_MANAGEMENT.
* The 'timerValue' is needed if the action of STK_CMD_TIMER_MANAGEMENT is
* 'STK_TIMER_DEACTIVATE' or 'STK_TIMER_GET_CURRENT_VALUE'. It shall state
* the current value of a timer. And the resolution is 1 second.
*
* @see MozStkTimer
*/
jsval timer;
};
dictionary MozStkCallEvent
{
/**
* The type of this event.
* It shall be one of following:
* - nsIDOMMozIccManager.STK_EVENT_TYPE_MT_CALL,
* - nsIDOMMozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
* - nsIDOMMozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED.
*/
unsigned short eventType;
/**
* Remote party number.
*/
DOMString number;
/**
* This field is available in 'STK_EVENT_TYPE_CALL_CONNECTED' and
* 'STK_EVENT_TYPE_CALL_DISCONNECTED' events.
* For the STK_EVENT_TYPE_CALL_CONNECTED event, setting this to true means the
* connection is answered by remote end, that is, this is an outgoing call.
* For the STK_EVENT_TYPE_CALL_DISCONNECTED event, setting this to true
* indicates the connection is hung up by remote.
*/
boolean isIssuedByRemote;
/**
* This field is available in Call Disconnected event to indicate the cause
* of disconnection. The cause string is passed to gaia through the error
* listener of nsIDOMCallEvent. Null if there's no error.
*/
DOMString error;
};
dictionary MozStkLocalInfo
{
/**
* IMEI information
*/
DOMString imei;
/**
* Location Information
*
* @see MozStkLocationInfo.
*/
jsval locationInfo;
/**
* Date information
*
* @see Date
*/
jsval date;
/**
* Language Information
*
* @see ISO 639-1, Alpha-2 code
*/
DOMString language;
};
dictionary MozStkLanguageSelectionEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION.
*/
unsigned short eventType;
/**
* Language Information
*
* @see ISO 639-1, Alpha-2 code
* "de" for German, "en" for English, "zh" for Chinese, etc.
*/
DOMString language;
};
dictionary MozStkBrowserTerminationEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION
*/
unsigned short eventType;
/**
* This object shall contain the browser termination cause.
* See TZ 102 223 8.51. It shall be one of following:
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR
*/
unsigned short terminationCause;
};
dictionary MozStkGeneralEvent
{
/**
* The type of this event, MozStkGeneralEvent can be used for all Stk Event
* requires no more parameter than event type, including
* nsIDOMMozIccManager.STK_EVENT_TYPE_USER_ACTIVITY.
* nsIDOMMozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE.
* HCI Connectivity Event(Not defined in interface yet).
*/
unsigned short eventType;
};

Просмотреть файл

@ -8,7 +8,6 @@ XPIDL_SOURCES += [
'nsIDOMIccInfo.idl',
'nsIDOMIccManager.idl',
'nsIIccProvider.idl',
'SimToolKit.idl',
]
XPIDL_MODULE = 'dom_icc'

Просмотреть файл

@ -8,7 +8,6 @@
#include "IDBDatabase.h"
#include "DictionaryHelpers.h"
#include "mozilla/Mutex.h"
#include "mozilla/storage.h"
#include "mozilla/dom/ContentParent.h"

Просмотреть файл

@ -39,7 +39,6 @@
#include "IDBKeyRange.h"
#include "IDBTransaction.h"
#include "DatabaseInfo.h"
#include "DictionaryHelpers.h"
#include "KeyPath.h"
#include "ProfilerHelpers.h"
#include "ReportInternalError.h"

Просмотреть файл

@ -16,8 +16,3 @@ interface nsIDOMMozApplicationEvent : nsIDOMEvent
in boolean aCancelable,
in mozIDOMApplication aApplication);
};
dictionary MozApplicationEventInit : EventInit
{
mozIDOMApplication application;
};

Просмотреть файл

@ -18,9 +18,3 @@ interface nsIDOMDeviceStorageChangeEvent : nsIDOMEvent
readonly attribute DOMString path;
readonly attribute DOMString reason;
};
dictionary DeviceStorageChangeEventInit : EventInit
{
DOMString path;
DOMString reason;
};

Просмотреть файл

@ -26,10 +26,3 @@ interface nsIDOMCloseEvent : nsIDOMEvent
in unsigned short aReasonCode,
in DOMString aReason);
};
dictionary CloseEventInit : EventInit
{
boolean wasClean;
unsigned short code;
DOMString reason;
};

Просмотреть файл

@ -17,8 +17,3 @@ interface nsIDOMCustomEvent : nsIDOMEvent
in boolean cancelableArg,
in nsIVariant detailArg);
};
dictionary CustomEventInit : EventInit
{
nsIVariant detail;
};

Просмотреть файл

@ -17,9 +17,3 @@ interface nsIDOMDOMTransactionEvent : nsIDOMEvent
in boolean canCancelArg,
in nsIVariant transactions);
};
dictionary DOMTransactionEventInit : EventInit
{
nsIVariant transactions;
};

Просмотреть файл

@ -40,11 +40,3 @@ interface nsIDOMDeviceOrientationEvent : nsIDOMEvent
readonly attribute double gamma;
readonly attribute boolean absolute;
};
dictionary DeviceOrientationEventInit : EventInit
{
double alpha;
double beta;
double gamma;
boolean absolute;
};

Просмотреть файл

@ -17,8 +17,3 @@ interface nsIDOMElementReplaceEvent : nsIDOMEvent
in boolean canCancelArg,
in nsIDOMElement upgrade);
};
dictionary ElementReplaceEventInit : EventInit
{
nsIDOMElement upgrade;
};

Просмотреть файл

@ -215,12 +215,6 @@ interface nsIDOMEvent : nsISupports
[notxpcom] DOMEventPtr InternalDOMEvent();
};
dictionary EventInit
{
boolean bubbles;
boolean cancelable;
};
%{C++
nsresult

Просмотреть файл

@ -17,9 +17,3 @@ interface nsIDOMHashChangeEvent : nsIDOMEvent
in DOMString oldURLArg,
in DOMString newURLArg);
};
dictionary HashChangeEventInit : EventInit
{
DOMString oldURL;
DOMString newURL;
};

Просмотреть файл

@ -27,8 +27,3 @@ interface nsIDOMPageTransitionEvent : nsIDOMEvent
in boolean canCancelArg,
in boolean persisted);
};
dictionary PageTransitionEventInit : EventInit
{
boolean persisted;
};

Просмотреть файл

@ -20,8 +20,3 @@ interface nsIDOMPopStateEvent : nsIDOMEvent
in boolean cancelableArg,
in nsIVariant stateArg);
};
dictionary PopStateEventInit : EventInit
{
nsIVariant state;
};

Просмотреть файл

@ -47,11 +47,3 @@ interface nsIDOMPopupBlockedEvent : nsIDOMEvent
in DOMString popupWindowName,
in DOMString popupWindowFeatures);
};
dictionary PopupBlockedEventInit : EventInit
{
nsIDOMWindow requestingWindow;
nsIURI popupWindowURI;
DOMString popupWindowFeatures;
DOMString popupWindowName;
};

Просмотреть файл

@ -24,9 +24,3 @@ interface nsIDOMProgressEvent : nsIDOMEvent
in unsigned long long loadedArg,
in unsigned long long totalArg);
};
dictionary ProgressEventInit : EventInit {
boolean lengthComputable;
unsigned long long loaded;
unsigned long long total;
};

Просмотреть файл

@ -25,7 +25,3 @@ interface nsIDOMRecordErrorEvent : nsIDOMEvent
in boolean aCancelable,
in DOMString aName);
};
dictionary RecordErrorEventInit : EventInit {
DOMString name;
};

Просмотреть файл

@ -19,9 +19,3 @@ interface nsIDOMSmartCardEvent : nsIDOMEvent
in boolean aCancelableArg,
in DOMString aTokenNAme);
};
dictionary SmartCardEventInit : EventInit
{
DOMString tokenName;
};

Просмотреть файл

@ -19,10 +19,3 @@ interface nsIDOMStyleRuleChangeEvent : nsIDOMEvent
in nsIDOMCSSStyleSheet aStyleSheet,
in nsIDOMCSSRule aRule);
};
dictionary StyleRuleChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
nsIDOMCSSRule rule;
};

Просмотреть файл

@ -18,10 +18,3 @@ interface nsIDOMStyleSheetApplicableStateChangeEvent : nsIDOMEvent
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aApplicable);
};
dictionary StyleSheetApplicableStateChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean applicable;
};

Просмотреть файл

@ -18,10 +18,3 @@ interface nsIDOMStyleSheetChangeEvent : nsIDOMEvent
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aDocumentSheet);
};
dictionary StyleSheetChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean documentSheet;
};

Просмотреть файл

@ -17,9 +17,3 @@ interface nsIDOMMozSettingsEvent : nsIDOMEvent
in DOMString aSettingName,
in nsIVariant aSettingValue);
};
dictionary MozSettingsEventInit : EventInit
{
DOMString settingName;
nsIVariant settingValue;
};

Просмотреть файл

@ -62,12 +62,3 @@ interface nsIDOMStorageEvent : nsIDOMEvent
in DOMString urlArg,
in nsIDOMStorage storageAreaArg);
};
dictionary StorageEventInit : EventInit
{
DOMString? key;
DOMString? oldValue;
DOMString? newValue;
DOMString url;
nsIDOMStorage storageArea;
};

Просмотреть файл

@ -696,82 +696,3 @@ interface nsIDOMMozMobileCFInfo : nsISupports
*/
readonly attribute unsigned short serviceClass;
};
dictionary MozCallBarringOption
{
/**
* Indicates the program the call is being barred.
*
* It shall be one of the nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_*
* values.
*/
unsigned short program;
/**
* Enable or disable the call barring program.
*/
boolean enabled;
/**
* Barring password. Use "" if no password specified.
*/
DOMString password;
/**
* Service for which the call barring is set up.
*
* It shall be one of the nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_*
* values.
*/
unsigned short serviceClass;
};
dictionary DOMMMIResult
{
/**
* String key that identifies the service associated with the MMI code
* request. The UI is supposed to handle the localization of the strings
* associated with this string key.
*/
DOMString serviceCode;
/**
* String key containing the status message of the associated MMI request.
* The UI is supposed to handle the localization of the strings associated
* with this string key.
*/
DOMString statusMessage;
/**
* Some MMI requests like call forwarding or PIN/PIN2/PUK/PUK2 related
* requests provide extra information along with the status message, this
* information can be a number, a string key or an array of string keys.
*/
jsval additionalInformation;
};
dictionary DOMCLIRStatus
{
/**
* CLIR parameter 'n': parameter sets the adjustment for outgoing calls.
*
* 0 Presentation indicator is used according to the subscription of the
* CLIR service (uses subscription default value).
* 1 CLIR invocation (restricts CLI presentation).
* 2 CLIR suppression (allows CLI presentation).
*/
unsigned short n;
/**
* CLIR parameter 'm': parameter shows the subscriber CLIR service status in
* the network.
* 0 CLIR not provisioned.
* 1 CLIR provisioned in permanent mode.
* 2 unknown (e.g. no network, etc.).
* 3 CLIR temporary mode presentation restricted.
*
* @see 3GPP TS 27.007 7.7 Defined values
*/
unsigned short m;
};

Просмотреть файл

@ -16,8 +16,3 @@ interface nsIDOMMozMmsEvent : nsIDOMEvent
in boolean aCancelable,
in nsIDOMMozMmsMessage aMessage);
};
dictionary MozMmsEventInit : EventInit
{
nsIDOMMozMmsMessage message;
};

Просмотреть файл

@ -7,26 +7,6 @@
interface nsIDOMBlob;
// If this is changed, change the WebIDL dictionary as well.
dictionary MmsAttachment
{
DOMString? id;
DOMString? location;
nsIDOMBlob content; // If the content blob is a text/plain type, the encoding
// for text should always be "utf-8".
};
dictionary MmsDeliveryInfo
{
DOMString? receiver;
DOMString? deliveryStatus;
DOMTimeStamp deliveryTimestamp; // 0 if not available (e.g.,
// |delivery| = "received" or not yet delivered).
DOMString? readStatus;
DOMTimeStamp readTimestamp; // 0 if not available (e.g.,
// |delivery| = "received" or not yet read).
};
[scriptable, builtinclass, uuid(f41d7400-0026-11e3-829d-eb7459c03810)]
interface nsIDOMMozMmsMessage : nsISupports
{

Просмотреть файл

@ -16,8 +16,3 @@ interface nsIDOMMozSmsEvent : nsIDOMEvent
in boolean aCancelable,
in nsIDOMMozSmsMessage aMessage);
};
dictionary MozSmsEventInit : EventInit
{
nsIDOMMozSmsMessage message;
};

Просмотреть файл

@ -5,15 +5,6 @@
#include "nsISupports.idl"
#include "nsIDOMSmsSegmentInfo.idl"
dictionary SmsThreadListItem
{
unsigned long long id;
DOMString senderOrReceiver;
unsigned long long timestamp;
DOMString body;
unsigned long long unreadCount;
};
[scriptable, uuid(46cf221e-9886-11e3-8039-171af7a2299e)]
interface nsIMobileMessageCallback : nsISupports
{

Просмотреть файл

@ -18,7 +18,6 @@
#include "nsCxPusher.h"
#include "MessageUtils.h"
using namespace mozilla::idl;
using namespace mozilla::dom::mobilemessage;
DOMCI_DATA(MozMmsMessage, mozilla::dom::MmsMessage)
@ -47,7 +46,7 @@ MmsMessage::MmsMessage(int32_t aId,
bool aRead,
const nsAString& aSubject,
const nsAString& aSmil,
const nsTArray<MmsAttachment>& aAttachments,
const nsTArray<Attachment>& aAttachments,
uint64_t aExpiryDate,
bool aReadReportRequested)
: mId(aId),
@ -88,12 +87,12 @@ MmsMessage::MmsMessage(const mobilemessage::MmsMessageData& aData)
for (uint32_t i = 0; i < len; i++) {
MmsAttachment att;
const MmsAttachmentData &element = aData.attachments()[i];
att.id = element.id();
att.location = element.location();
att.mId = element.id();
att.mLocation = element.location();
if (element.contentParent()) {
att.content = static_cast<BlobParent*>(element.contentParent())->GetBlob();
att.mContent = static_cast<BlobParent*>(element.contentParent())->GetBlob();
} else if (element.contentChild()) {
att.content = static_cast<BlobChild*>(element.contentChild())->GetBlob();
att.mContent = static_cast<BlobChild*>(element.contentChild())->GetBlob();
} else {
NS_WARNING("MmsMessage: Unable to get attachment content.");
}
@ -106,10 +105,10 @@ MmsMessage::MmsMessage(const mobilemessage::MmsMessageData& aData)
MmsDeliveryInfo info;
const MmsDeliveryInfoData &infoData = aData.deliveryInfo()[i];
// Prepare |info.receiver|.
info.receiver = infoData.receiver();
// Prepare |info.mReceiver|.
info.mReceiver = infoData.receiver();
// Prepare |info.deliveryStatus|.
// Prepare |info.mDeliveryStatus|.
nsString statusStr;
switch (infoData.deliveryStatus()) {
case eDeliveryStatus_NotApplicable:
@ -134,12 +133,12 @@ MmsMessage::MmsMessage(const mobilemessage::MmsMessageData& aData)
default:
MOZ_CRASH("We shouldn't get any other delivery status!");
}
info.deliveryStatus = statusStr;
info.mDeliveryStatus = statusStr;
// Prepare |info.deliveryTimestamp|.
info.deliveryTimestamp = infoData.deliveryTimestamp();
// Prepare |info.mDeliveryTimestamp|.
info.mDeliveryTimestamp = infoData.deliveryTimestamp();
// Prepare |info.readStatus|.
// Prepare |info.mReadStatus|.
nsString statusReadString;
switch(infoData.readStatus()) {
case eReadStatus_NotApplicable:
@ -158,10 +157,10 @@ MmsMessage::MmsMessage(const mobilemessage::MmsMessageData& aData)
default:
MOZ_CRASH("We shouldn't get any other read status!");
}
info.readStatus = statusReadString;
info.mReadStatus = statusReadString;
// Prepare |info.readTimestamp|.
info.readTimestamp = infoData.readTimestamp();
// Prepare |info.mReadTimestamp|.
info.mReadTimestamp = infoData.readTimestamp();
mDeliveryInfo.AppendElement(info);
}
@ -225,8 +224,9 @@ MmsMessage::Create(int32_t aId,
}
MmsDeliveryInfo info;
nsresult rv = info.Init(aCx, infoJsVal.address());
NS_ENSURE_SUCCESS(rv, rv);
if (!info.Init(aCx, infoJsVal)) {
return NS_ERROR_TYPE_ERR;
}
deliveryInfo.AppendElement(info);
}
@ -274,7 +274,7 @@ MmsMessage::Create(int32_t aId,
return NS_ERROR_INVALID_ARG;
}
nsTArray<MmsAttachment> attachments;
nsTArray<Attachment> attachments;
MOZ_ALWAYS_TRUE(JS_GetArrayLength(aCx, attachmentsObj, &length));
JS::Rooted<JS::Value> attachmentJsVal(aCx);
@ -284,8 +284,9 @@ MmsMessage::Create(int32_t aId,
}
MmsAttachment attachment;
rv = attachment.Init(aCx, attachmentJsVal.address());
NS_ENSURE_SUCCESS(rv, rv);
if (!attachment.Init(aCx, attachmentJsVal)) {
return NS_ERROR_TYPE_ERR;
}
attachments.AppendElement(attachment);
}
@ -339,48 +340,48 @@ MmsMessage::GetData(ContentParent* aParent,
MmsDeliveryInfoData infoData;
const MmsDeliveryInfo &info = mDeliveryInfo[i];
// Prepare |infoData.receiver|.
infoData.receiver().Assign(info.receiver);
// Prepare |infoData.mReceiver|.
infoData.receiver().Assign(info.mReceiver);
// Prepare |infoData.deliveryStatus|.
// Prepare |infoData.mDeliveryStatus|.
DeliveryStatus status;
if (info.deliveryStatus.Equals(DELIVERY_STATUS_NOT_APPLICABLE)) {
if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_NOT_APPLICABLE)) {
status = eDeliveryStatus_NotApplicable;
} else if (info.deliveryStatus.Equals(DELIVERY_STATUS_SUCCESS)) {
} else if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_SUCCESS)) {
status = eDeliveryStatus_Success;
} else if (info.deliveryStatus.Equals(DELIVERY_STATUS_PENDING)) {
} else if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_PENDING)) {
status = eDeliveryStatus_Pending;
} else if (info.deliveryStatus.Equals(DELIVERY_STATUS_ERROR)) {
} else if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_ERROR)) {
status = eDeliveryStatus_Error;
} else if (info.deliveryStatus.Equals(DELIVERY_STATUS_REJECTED)) {
} else if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_REJECTED)) {
status = eDeliveryStatus_Reject;
} else if (info.deliveryStatus.Equals(DELIVERY_STATUS_MANUAL)) {
} else if (info.mDeliveryStatus.Equals(DELIVERY_STATUS_MANUAL)) {
status = eDeliveryStatus_Manual;
} else {
return false;
}
infoData.deliveryStatus() = status;
// Prepare |infoData.deliveryTimestamp|.
infoData.deliveryTimestamp() = info.deliveryTimestamp;
// Prepare |infoData.mDeliveryTimestamp|.
infoData.deliveryTimestamp() = info.mDeliveryTimestamp;
// Prepare |infoData.readStatus|.
// Prepare |infoData.mReadStatus|.
ReadStatus readStatus;
if (info.readStatus.Equals(READ_STATUS_NOT_APPLICABLE)) {
if (info.mReadStatus.Equals(READ_STATUS_NOT_APPLICABLE)) {
readStatus = eReadStatus_NotApplicable;
} else if (info.readStatus.Equals(READ_STATUS_SUCCESS)) {
} else if (info.mReadStatus.Equals(READ_STATUS_SUCCESS)) {
readStatus = eReadStatus_Success;
} else if (info.readStatus.Equals(READ_STATUS_PENDING)) {
} else if (info.mReadStatus.Equals(READ_STATUS_PENDING)) {
readStatus = eReadStatus_Pending;
} else if (info.readStatus.Equals(READ_STATUS_ERROR)) {
} else if (info.mReadStatus.Equals(READ_STATUS_ERROR)) {
readStatus = eReadStatus_Error;
} else {
return false;
}
infoData.readStatus() = readStatus;
// Prepare |infoData.readTimestamp|.
infoData.readTimestamp() = info.readTimestamp;
// Prepare |infoData.mReadTimestamp|.
infoData.readTimestamp() = info.mReadTimestamp;
aData.deliveryInfo().AppendElement(infoData);
}
@ -388,7 +389,7 @@ MmsMessage::GetData(ContentParent* aParent,
aData.attachments().SetCapacity(mAttachments.Length());
for (uint32_t i = 0; i < mAttachments.Length(); i++) {
MmsAttachmentData mma;
const MmsAttachment &element = mAttachments[i];
const Attachment &element = mAttachments[i];
mma.id().Assign(element.id);
mma.location().Assign(element.location);
@ -496,10 +497,10 @@ MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDelive
JS::Rooted<JS::Value> tmpJsVal(aCx);
JSString* tmpJsStr;
// Get |info.receiver|.
// Get |info.mReceiver|.
tmpJsStr = JS_NewUCStringCopyN(aCx,
info.receiver.get(),
info.receiver.Length());
info.mReceiver.get(),
info.mReceiver.Length());
NS_ENSURE_TRUE(tmpJsStr, NS_ERROR_OUT_OF_MEMORY);
tmpJsVal.setString(tmpJsStr);
@ -508,10 +509,10 @@ MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDelive
return NS_ERROR_FAILURE;
}
// Get |info.deliveryStatus|.
// Get |info.mDeliveryStatus|.
tmpJsStr = JS_NewUCStringCopyN(aCx,
info.deliveryStatus.get(),
info.deliveryStatus.Length());
info.mDeliveryStatus.get(),
info.mDeliveryStatus.Length());
NS_ENSURE_TRUE(tmpJsStr, NS_ERROR_OUT_OF_MEMORY);
tmpJsVal.setString(tmpJsStr);
@ -520,17 +521,17 @@ MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDelive
return NS_ERROR_FAILURE;
}
// Get |info.deliveryTimestamp|.
tmpJsVal.setNumber(static_cast<double>(info.deliveryTimestamp));
// Get |info.mDeliveryTimestamp|.
tmpJsVal.setNumber(static_cast<double>(info.mDeliveryTimestamp));
if (!JS_DefineProperty(aCx, infoJsObj, "deliveryTimestamp", tmpJsVal,
nullptr, nullptr, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
// Get |info.readStatus|.
// Get |info.mReadStatus|.
tmpJsStr = JS_NewUCStringCopyN(aCx,
info.readStatus.get(),
info.readStatus.Length());
info.mReadStatus.get(),
info.mReadStatus.Length());
NS_ENSURE_TRUE(tmpJsStr, NS_ERROR_OUT_OF_MEMORY);
tmpJsVal.setString(tmpJsStr);
@ -539,8 +540,8 @@ MmsMessage::GetDeliveryInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aDelive
return NS_ERROR_FAILURE;
}
// Get |info.readTimestamp|.
tmpJsVal.setNumber(static_cast<double>(info.readTimestamp));
// Get |info.mReadTimestamp|.
tmpJsVal.setNumber(static_cast<double>(info.mReadTimestamp));
if (!JS_DefineProperty(aCx, infoJsObj, "readTimestamp", tmpJsVal,
nullptr, nullptr, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
@ -618,7 +619,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachm
NS_ENSURE_TRUE(attachments, NS_ERROR_OUT_OF_MEMORY);
for (uint32_t i = 0; i < length; ++i) {
const MmsAttachment &attachment = mAttachments[i];
const Attachment &attachment = mAttachments[i];
JS::Rooted<JSObject*> attachmentObj(
aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));

Просмотреть файл

@ -9,8 +9,8 @@
#include "nsIDOMMozMmsMessage.h"
#include "nsString.h"
#include "mozilla/dom/mobilemessage/Types.h"
#include "mozilla/dom/MozMmsMessageBinding.h"
#include "mozilla/Attributes.h"
#include "DictionaryHelpers.h"
namespace mozilla {
namespace dom {
@ -27,11 +27,25 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZMMSMESSAGE
// If this is changed, change the WebIDL dictionary as well.
struct Attachment MOZ_FINAL
{
nsCOMPtr<nsIDOMBlob> content;
nsString id;
nsString location;
explicit Attachment(const MmsAttachment& aAttachment) :
content(aAttachment.mContent),
id(aAttachment.mId),
location(aAttachment.mLocation)
{}
};
MmsMessage(int32_t aId,
uint64_t aThreadId,
const nsAString& aIccId,
mobilemessage::DeliveryState aDelivery,
const nsTArray<idl::MmsDeliveryInfo>& aDeliveryInfo,
const nsTArray<MmsDeliveryInfo>& aDeliveryInfo,
const nsAString& aSender,
const nsTArray<nsString>& aReceivers,
uint64_t aTimestamp,
@ -39,7 +53,7 @@ public:
bool aRead,
const nsAString& aSubject,
const nsAString& aSmil,
const nsTArray<idl::MmsAttachment>& aAttachments,
const nsTArray<Attachment>& aAttachments,
uint64_t aExpiryDate,
bool aReadReportRequested);
@ -72,7 +86,7 @@ private:
uint64_t mThreadId;
nsString mIccId;
mobilemessage::DeliveryState mDelivery;
nsTArray<idl::MmsDeliveryInfo> mDeliveryInfo;
nsTArray<MmsDeliveryInfo> mDeliveryInfo;
nsString mSender;
nsTArray<nsString> mReceivers;
uint64_t mTimestamp;
@ -80,7 +94,7 @@ private:
bool mRead;
nsString mSubject;
nsString mSmil;
nsTArray<idl::MmsAttachment> mAttachments;
nsTArray<Attachment> mAttachments;
uint64_t mExpiryDate;
bool mReadReportRequested;
};

Просмотреть файл

@ -10,7 +10,6 @@
#include "SmsMessage.h"
#include "SmsFilter.h"
#include "SmsSegmentInfo.h"
#include "DictionaryHelpers.h"
#include "nsJSUtils.h"
#include "nsCxPusher.h"
#include "mozilla/dom/MobileMessageManagerBinding.h"

Просмотреть файл

@ -6,22 +6,6 @@
interface nsIDOMDOMRequest;
/**
* Provide the detailed options for specifying different kinds of data filtering
* in getSamples function.
*/
dictionary NetworkStatsGetOptions
{
/**
* App manifest URL is used to filter network stats by app, while service type
* is used to filter stats by system service.
* Note that, these two options cannot be specified at the same time for now;
* others, an NS_ERROR_NOT_IMPLMENTED exception will be thrown.
*/
DOMString appManifestURL;
DOMString serviceType;
};
/**
* Represents a data interface for which the manager is recording statistics.
*/
@ -36,12 +20,6 @@ interface nsIDOMMozNetworkStatsInterface : nsISupports
readonly attribute DOMString id;
};
dictionary NetworkStatsAlarmOptions
{
jsval startTime; // Date object
jsval data;
};
[scriptable, builtinclass, uuid(063ebeb2-5c6e-47ae-bdcd-5e6ebdc7a68c)]
interface nsIDOMMozNetworkStatsAlarm : nsISupports
{

Просмотреть файл

@ -32,7 +32,6 @@
#include "nsIGeolocationProvider.h"
#include "nsIContentPermissionPrompt.h"
#include "nsIDOMWindow.h"
#include "DictionaryHelpers.h"
#include "mozilla/Attributes.h"
class nsGeolocationService;

Просмотреть файл

@ -21,8 +21,3 @@ interface nsIDOMMozVoicemailEvent : nsIDOMEvent
in boolean aCancelable,
in nsIDOMMozVoicemailStatus aStatus);
};
dictionary MozVoicemailEventInit : EventInit
{
nsIDOMMozVoicemailStatus status;
};

Просмотреть файл

@ -4,11 +4,21 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// If this is changed, change the XPIDL dictionary as well.
// If this is changed, change the MmsMessage.h structure as well.
dictionary MmsAttachment {
DOMString? id = null;
DOMString? location = null;
Blob? content = null;
};
dictionary MmsDeliveryInfo {
DOMString? receiver = null;
DOMString? deliveryStatus = null;
DOMTimeStamp deliveryTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet delivered).
DOMString? readStatus = null;
DOMTimeStamp readTimestamp = 0; // 0 if not available (e.g.,
// |delivery| = "received" or not yet read).
};
// If we start using MmsParameters here, remove it from DummyBinding.

Просмотреть файл

@ -0,0 +1,82 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
dictionary MozCallBarringOption
{
/**
* Indicates the program the call is being barred.
*
* It shall be one of the nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_*
* values.
*/
unsigned short program;
/**
* Enable or disable the call barring program.
*/
boolean enabled;
/**
* Barring password. Use "" if no password specified.
*/
DOMString password;
/**
* Service for which the call barring is set up.
*
* It shall be one of the nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_*
* values.
*/
unsigned short serviceClass;
};
dictionary DOMMMIResult
{
/**
* String key that identifies the service associated with the MMI code
* request. The UI is supposed to handle the localization of the strings
* associated with this string key.
*/
DOMString serviceCode;
/**
* String key containing the status message of the associated MMI request.
* The UI is supposed to handle the localization of the strings associated
* with this string key.
*/
DOMString statusMessage;
/**
* Some MMI requests like call forwarding or PIN/PIN2/PUK/PUK2 related
* requests provide extra information along with the status message, this
* information can be a number, a string key or an array of string keys.
*/
any additionalInformation;
};
dictionary DOMCLIRStatus
{
/**
* CLIR parameter 'n': parameter sets the adjustment for outgoing calls.
*
* 0 Presentation indicator is used according to the subscription of the
* CLIR service (uses subscription default value).
* 1 CLIR invocation (restricts CLI presentation).
* 2 CLIR suppression (allows CLI presentation).
*/
unsigned short n;
/**
* CLIR parameter 'm': parameter shows the subscriber CLIR service status in
* the network.
* 0 CLIR not provisioned.
* 1 CLIR provisioned in permanent mode.
* 2 unknown (e.g. no network, etc.).
* 3 CLIR temporary mode presentation restricted.
*
* @see 3GPP TS 27.007 7.7 Defined values
*/
unsigned short m;
};

Просмотреть файл

@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Provide the detailed options for specifying different kinds of data filtering
* in getSamples function.
*/
dictionary NetworkStatsGetOptions
{
/**
* App manifest URL is used to filter network stats by app, while service type
* is used to filter stats by system service.
* Note that, these two options cannot be specified at the same time for now;
* others, an NS_ERROR_NOT_IMPLMENTED exception will be thrown.
*/
DOMString appManifestURL;
DOMString serviceType;
};
dictionary NetworkStatsAlarmOptions
{
Date startTime;
Date data;
};

Просмотреть файл

@ -15,3 +15,644 @@ dictionary MozStkCommandEventInit : EventInit
{
any command = null;
};
dictionary MozStkTextMessage
{
/**
* Text String.
*
* @see TS 11.14, clause 12.15, Text String.
*/
DOMString text;
/**
* The length of time for which the ME shall display the dialog.
*/
MozStkDuration duration;
/**
* Indicate this text message is high priority or normal priority.
*
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 1.
*
* High priority text shall be displayed on the screen immediately, except if
* there is a conflict of priority level of alerting such as incoming calls
* or a low battery warning. In that situation, the resolution is left to
* the terminal. If the command is rejected in spite of the high priority,
* the terminal shall inform the ICC with resultCode is
* TERMINAL_CRNTLY_UNABLE_TO_PROCESS in MozStkResponse.
*
* true: high priority
* false: normal priority
*/
boolean isHighPriority;
/**
* Need to wait for user to clear message or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 8.
*
* If this attribute is true, but user doesn't give any input within a period
* of time(said 30 secs), the terminal shall inform the ICC with resultCode
* is NO_RESPONSE_FROM_USER in MozStkResponse.
*
* true: Wait for user to clear message.
* false: clear message after a delay.
*/
boolean userClear;
/**
* Need to response immediately or not.
*
* @see TS 11.14, clause 12.43, Immediate response.
*
* When this attribute is true, the terminal shall immediately send
* MozStkResponse with resultCode is OK.
*
* true: The terminal shall send response immediately.
* false: otherwise.
*/
boolean responseNeeded;
};
dictionary MozStkItem
{
/**
* Identifier of item.
*
* The identifier is a single byte between '01' and 'FF'. Each item shall
* have a unique identifier within an Item list.
*/
unsigned short identifier;
/**
* Text string of item.
*/
DOMString text;
};
dictionary MozStkMenu
{
/**
* Array of MozStkItem.
*
* @see TS 11.14, clause 12.9
*/
sequence<MozStkItem> items;
/**
* Presentation type, one of TYPE_*.
*/
unsigned short presentationType;
/**
* Title of the menu.
*/
DOMString title;
/**
* Default item identifier of the menu.
*/
unsigned short defaultItem;
/**
* Help information available or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, SET UP MENU, bit 8.
*
* true: help information available.
* false: no help information available.
*/
boolean isHelpAvailable;
/**
* List of Next Action Indicators.
* Each element should be one of nsIDOMMozIccManager.STK_CMD_*
* or nsIDOMMozIccManager.STK_NEXT_ACTION_*
* If it's STK_NEXT_ACTION_NULL, the terminal should ignore this action
* in corresponding item.
*
* @see TS 11.14, clause 12.24, Items Next Action Indicator.
*/
sequence<unsigned short> nextActionList;
};
dictionary MozStkInput
{
/**
* Text for the ME to display in conjunction with asking the user to respond.
*/
DOMString text;
/**
* The length of time for which the ME shall display the dialog. This field
* is used only for GET INKEY.
*
* @see TS 11.14, clause 11.8, duration, GET INKEY T.C 27.22.4.2.8.4.2
*/
MozStkDuration duration;
/**
* Minimum length of response.
*/
unsigned short minLength;
/**
* Maximum length of response.
*/
unsigned short maxLength;
/**
* Text for the ME to display, corresponds to a default text string offered
* by the ICC.
*/
DOMString defaultText;
/**
* Input format.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 1.
*
* true: Alphabet set.
* false: Digits only.
*/
boolean isAlphabet;
/**
* Alphabet encoding.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 2.
*
* true: UCS2 alphabet.
* false: default SMS alphabet.
*/
boolean isUCS2;
/**
* Visibility of input.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 3.
*
* true: User input shall not be revealed in any way.
* false: ME may echo user input on the display.
*/
boolean hideInput;
/**
* Yes/No response is requested.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INKEY, bit 3.
*
* true: Yes/No response is requested, and character sets
* (Alphabet set and UCS2) are disabled.
* false: Character sets (Alphabet set and UCS2) are enabled.
*/
boolean isYesNoRequested;
/**
* User input in packed or unpacked format.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 4.
*
* true: User input to be in SMS packed format.
* false: User input to be in unpacked format.
*/
boolean isPacked;
/**
* Help information available or not.
*
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
*
* true: help information available.
* false: no help information available.
*/
boolean isHelpAvailable;
};
dictionary MozStkBrowserSetting
{
/**
* Confirm message to launch browser.
*/
MozStkTextMessage confirmMessage;
/**
* The URL to be opened by browser.
*/
DOMString url;
/**
* One of STK_BROWSER_MODE_*.
*
* @see nsIDOMMozIccManager.STK_BROWSER_MODE_*
*/
unsigned short mode;
};
dictionary MozStkSetUpCall
{
/**
* The Dialling number.
*/
DOMString address;
/**
* The text message used in user confirmation phase.
*/
MozStkTextMessage confirmMessage;
/**
* The text message used in call set up phase.
*/
MozStkTextMessage callMessage;
/**
* The Optional maximum duration for the redial mechanism.
* The time elapsed since the first call set-up attempt has exceeded the duration
* requested by the UICC, the redial mechanism is terminated.
*/
MozStkDuration duration;
};
dictionary MozStkSetUpEventList
{
/**
* The list of events that needs to provide details to ICC when they happen.
* When this valus is null, means an indication to remove the existing list
* of events in ME.
*
* @see nsIDOMMozIccManager.STK_EVENT_TYPE_*
*/
sequence<unsigned short> eventList;
};
dictionary MozStkLocationInfo
{
/**
* Mobile Country Code (MCC) of the current serving operator.
*/
unsigned short mcc;
/**
* Mobile Network Code (MNC) of the current serving operator.
*/
unsigned short mnc;
/**
* Mobile Location Area Code (LAC) for the current serving operator.
*/
unsigned short gsmLocationAreaCode;
/**
* Mobile Cell ID for the current serving operator.
*/
unsigned long gsmCellId;
};
dictionary MozStkDuration
{
/**
* Time unit used, should be one of STK_TIME_UNIT_*.
*/
unsigned short timeUnit;
/**
* The length of time required, expressed in timeUnit.
*/
octet timeInterval;
};
dictionary MozStkPlayTone
{
/**
* Text String.
*/
DOMString text;
/**
* One of STK_TONE_TYPE_*.
*/
unsigned short tone;
/**
* The length of time for which the ME shall generate the tone.
*/
MozStkDuration duration;
/**
* Need to vibrate or not.
* true: vibrate alert, if available, with the tone.
* false: use of vibrate alert is up to the ME.
*/
boolean isVibrate;
};
dictionary MozStkProvideLocalInfo
{
/**
* Indicate which local information is required.
* It shall be one of following:
* - nsIDOMMozIccManager.STK_LOCAL_INFO_LOCATION_INFO
* - nsIDOMMozIccManager.STK_LOCAL_INFO_IMEI
* - nsIDOMMozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE
* - nsIDOMMozIccManager.STK_LOCAL_INFO_LANGUAGE
*/
unsigned short localInfoType;
};
dictionary MozStkLocationEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_LOCATION_STATUS;
*/
unsigned short eventType;
/**
* Indicate current service state of the MS with one of the values listed
* below:
* - nsIDOMMozIccManager.STK_SERVICE_STATE_NORMAL
* - nsIDOMMozIccManager.STK_SERVICE_STATE_LIMITED
* - nsIDOMMozIccManager.STK_SERVICE_STATE_UNAVAILABLE
*/
unsigned short locationStatus;
/**
* See MozStkLocationInfo.
* This value shall only be provided if the locationStatus indicates
* 'STK_SERVICE_STATE_NORMAL'.
*/
MozStkLocationInfo locationInfo;
};
dictionary MozStkTimer
{
/**
* Identifier of a timer.
*/
octet timerId;
/**
* Length of time during which the timer has to run.
* The resolution of a timer is 1 second.
*/
unsigned long timerValue;
/**
* The action requested from UICC.
* It shall be one of below:
* - nsIDOMMozIccManager.STK_TIMER_START
* - nsIDOMMozIccManager.STK_TIMER_DEACTIVATE
* - nsIDOMMozIccManager.STK_TIMER_GET_CURRENT_VALUE
*/
unsigned short timerAction;
};
dictionary MozStkBipMessage
{
/**
* Text String
*/
DOMString text;
};
dictionary MozStkCommand
{
/**
* The number of command issued by ICC. And it is assigned
* by ICC may take any hexadecimal value betweean '01' and 'FE'.
*
* @see TS 11.14, clause 6.5.1
*/
unsigned short commandNumber;
/**
* One of STK_CMD_*
*/
unsigned short typeOfCommand;
/**
* Qualifiers specific to the command.
*/
unsigned short commandQualifier;
/**
* options varies accrording to the typeOfCommand in MozStkCommand.
*
* When typeOfCommand is
* - STK_CMD_DISPLAY_TEXT
* - STK_CMD_SET_UP_IDLE_MODE_TEXT
* - STK_CMD_SEND_{SS|USSD|SMS|DTMF},
* options is MozStkTextMessage.
*
* When typeOfCommand is
* - STK_CMD_SELECT_ITEM
* - STK_CMD_SET_UP_MENU
* options is MozStkMenu.
*
* When typeOfCommand is
* - STK_CMD_GET_INKEY
* - STK_CMD_GET_INPUT,
* options is MozStkInput.
*
* When typeOfCommand is
* - STK_CMD_LAUNCH_BROWSER
* options is MozStkBrowserSetting.
*
* When typeOfCommand is
* - STK_CMD_SET_UP_CALL
* options is MozStkSetUpCall.
*
* When typeOfCommand is
* - STK_CMD_SET_UP_EVENT_LIST
* options is MozStkSetUpEventList.
*
* When typeOfCommand is
* - STK_CMD_PLAY_TONE
* options is MozStkPlayTone.
*
* When typeOfCommand is
* - STK_CMD_POLL_INTERVAL
* options is MozStkDuration.
*
* When typeOfCommand is
* - STK_CMD_PROVIDE_LOCAL_INFO
* options is MozStkProvideLocalInfo.
*
* When typeOfCommand is
* - STK_CMD_TIMER_MANAGEMENT
* option is MozStkTimer
*
* When typeOfCommand is
* - STK_CMD_OPEN_CHANNEL
* - STK_CMD_CLOSE_CHANNEL
* - STK_CMD_SEND_DATA
* - STK_CMD_RECEIVE_DATA
* options is MozStkBipMessage
*
* When typeOfCommand is
* - STK_CMD_POLL_OFF
* options is null.
*
* When typeOfCommand is
* - STK_CMD_REFRESH
* options is null.
*/
any options;
};
dictionary MozStkResponse
{
/**
* One of RESULT_*
*/
unsigned short resultCode;
/**
* The identifier of the item selected by user.
*
* @see MozStkItem.identifier
*/
unsigned short itemIdentifier;
/**
* User input.
*/
DOMString input;
/**
* YES/NO response.
*
* @see MozStkInput.isYesNoRequested
*/
boolean isYesNo;
/**
* User has confirmed or rejected the call during STK_CMD_CALL_SET_UP.
*
* @see RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
*
* true: Confirmed by User.
* false: Rejected by User.
*/
boolean hasConfirmed;
/**
* The response for STK_CMD_PROVIDE_LOCAL_INFO
*/
MozStkLocalInfo localInfo;
/**
* The response for STK_CMD_TIMER_MANAGEMENT.
* The 'timerValue' is needed if the action of STK_CMD_TIMER_MANAGEMENT is
* 'STK_TIMER_DEACTIVATE' or 'STK_TIMER_GET_CURRENT_VALUE'. It shall state
* the current value of a timer. And the resolution is 1 second.
*/
MozStkTimer timer;
};
dictionary MozStkCallEvent
{
/**
* The type of this event.
* It shall be one of following:
* - nsIDOMMozIccManager.STK_EVENT_TYPE_MT_CALL,
* - nsIDOMMozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
* - nsIDOMMozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED.
*/
unsigned short eventType;
/**
* Remote party number.
*/
DOMString number;
/**
* This field is available in 'STK_EVENT_TYPE_CALL_CONNECTED' and
* 'STK_EVENT_TYPE_CALL_DISCONNECTED' events.
* For the STK_EVENT_TYPE_CALL_CONNECTED event, setting this to true means the
* connection is answered by remote end, that is, this is an outgoing call.
* For the STK_EVENT_TYPE_CALL_DISCONNECTED event, setting this to true
* indicates the connection is hung up by remote.
*/
boolean isIssuedByRemote;
/**
* This field is available in Call Disconnected event to indicate the cause
* of disconnection. The cause string is passed to gaia through the error
* listener of nsIDOMCallEvent. Null if there's no error.
*/
DOMString error;
};
dictionary MozStkLocalInfo
{
/**
* IMEI information
*/
DOMString imei;
/**
* Location Information
*/
MozStkLocationInfo locationInfo;
/**
* Date information
*/
Date date;
/**
* Language Information
*
* @see ISO 639-1, Alpha-2 code
*/
DOMString language;
};
dictionary MozStkLanguageSelectionEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION.
*/
unsigned short eventType;
/**
* Language Information
*
* @see ISO 639-1, Alpha-2 code
* "de" for German, "en" for English, "zh" for Chinese, etc.
*/
DOMString language;
};
dictionary MozStkBrowserTerminationEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION
*/
unsigned short eventType;
/**
* This object shall contain the browser termination cause.
* See TZ 102 223 8.51. It shall be one of following:
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR
*/
unsigned short terminationCause;
};
dictionary MozStkGeneralEvent
{
/**
* The type of this event, MozStkGeneralEvent can be used for all Stk Event
* requires no more parameter than event type, including
* nsIDOMMozIccManager.STK_EVENT_TYPE_USER_ACTIVITY.
* nsIDOMMozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE.
* HCI Connectivity Event(Not defined in interface yet).
*/
unsigned short eventType;
};

Просмотреть файл

@ -237,7 +237,9 @@ WEBIDL_FILES = [
'MozActivity.webidl',
'MozConnection.webidl',
'MozMmsMessage.webidl',
'MozMobileConnection.webidl',
'MozNamedAttrMap.webidl',
'MozNetworkStats.webidl',
'MozPowerManager.webidl',
'MozTimeManager.webidl',
'MozWakeLock.webidl',

Просмотреть файл

@ -43,13 +43,3 @@ interface nsIDOMMozWifiConnectionInfoEvent : nsIDOMEvent
in long linkSpeed,
in DOMString ipAddress);
};
dictionary MozWifiConnectionInfoEventInit : EventInit
{
nsIVariant network;
short signalStrength;
short relSignalStrength;
long linkSpeed;
DOMString ipAddress;
};

Просмотреть файл

@ -17,8 +17,3 @@ interface nsIDOMMozWifiP2pStatusChangeEvent : nsIDOMEvent
in boolean aCancelable,
in DOMString aPeerAddress);
};
dictionary MozWifiP2pStatusChangeEventInit : EventInit
{
DOMString peerAddress;
};

Просмотреть файл

@ -27,9 +27,3 @@ interface nsIDOMMozWifiStatusChangeEvent : nsIDOMEvent
in nsIVariant aNetwork,
in DOMString aStatus);
};
dictionary MozWifiStatusChangeEventInit : EventInit
{
nsIVariant network;
DOMString status;
};

Просмотреть файл

@ -148,7 +148,7 @@ namespace {
const uint32_t kNoIndex = uint32_t(-1);
const JS::ContextOptions kRequiredJSContextOptions =
const JS::ContextOptions kRequiredContextOptions =
JS::ContextOptions().setDontReportUncaught(true)
.setNoScriptRval(true);
@ -300,7 +300,7 @@ GenerateSharedWorkerKey(const nsACString& aScriptSpec, const nsACString& aName,
}
void
LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
LoadRuntimeAndContextOptions(const char* aPrefName, void* /* aClosure */)
{
AssertIsOnMainThread();
@ -330,51 +330,47 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
}
#endif
// Runtime options.
JS::RuntimeOptions runtimeOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"))) {
runtimeOptions.setAsmJS(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference"))) {
runtimeOptions.setTypeInference(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit"))) {
runtimeOptions.setBaseline(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion"))) {
runtimeOptions.setIon(true);
}
// Common options.
JS::ContextOptions commonOptions = kRequiredJSContextOptions;
JS::ContextOptions commonContextOptions = kRequiredContextOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict"))) {
commonOptions.setExtraWarnings(true);
commonContextOptions.setExtraWarnings(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror"))) {
commonOptions.setWerror(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"))) {
commonOptions.setAsmJS(true);
commonContextOptions.setWerror(true);
}
// Content options.
JS::ContextOptions contentOptions = commonOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.content"))) {
contentOptions.setBaseline(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion.content"))) {
contentOptions.setIon(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference.content"))) {
contentOptions.setTypeInference(true);
}
JS::ContextOptions contentContextOptions = commonContextOptions;
// Chrome options.
JS::ContextOptions chromeOptions = commonOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.chrome"))) {
chromeOptions.setBaseline(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion.chrome"))) {
chromeOptions.setIon(true);
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("typeinference.chrome"))) {
chromeOptions.setTypeInference(true);
}
JS::ContextOptions chromeContextOptions = commonContextOptions;
#ifdef DEBUG
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict.debug"))) {
chromeOptions.setExtraWarnings(true);
chromeContextOptions.setExtraWarnings(true);
}
#endif
RuntimeService::SetDefaultJSContextOptions(contentOptions, chromeOptions);
RuntimeService::SetDefaultRuntimeAndContextOptions(runtimeOptions,
contentContextOptions,
chromeContextOptions);
if (rts) {
rts->UpdateAllWorkerJSContextOptions();
rts->UpdateAllWorkerRuntimeAndContextOptions();
}
}
@ -772,6 +768,8 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
JSSettings settings;
aWorkerPrivate->CopyJSSettings(settings);
JS::RuntimeOptionsRef(aRuntime) = settings.runtimeOptions;
JSSettings::JSGCSettingsArray& gcSettings = settings.gcSettings;
// This is the real place where we set the max memory for the runtime.
@ -1615,10 +1613,11 @@ RuntimeService::Init()
// Initialize JSSettings.
if (!sDefaultJSSettings.gcSettings[0].IsSet()) {
sDefaultJSSettings.chrome.contextOptions = kRequiredJSContextOptions;
sDefaultJSSettings.runtimeOptions = JS::RuntimeOptions();
sDefaultJSSettings.chrome.contextOptions = kRequiredContextOptions;
sDefaultJSSettings.chrome.maxScriptRuntime = -1;
sDefaultJSSettings.chrome.compartmentOptions.setVersion(JSVERSION_LATEST);
sDefaultJSSettings.content.contextOptions = kRequiredJSContextOptions;
sDefaultJSSettings.content.contextOptions = kRequiredContextOptions;
sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC;
#ifdef JS_GC_ZEAL
sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ;
@ -1693,13 +1692,13 @@ RuntimeService::Init()
PREF_DOM_WINDOW_DUMP_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DUMP))) ||
#endif
NS_FAILED(Preferences::RegisterCallback(LoadJSContextOptions,
NS_FAILED(Preferences::RegisterCallback(LoadRuntimeAndContextOptions,
PREF_JS_OPTIONS_PREFIX,
nullptr)) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
LoadJSContextOptions,
PREF_WORKERS_OPTIONS_PREFIX,
nullptr)) ||
LoadRuntimeAndContextOptions,
PREF_WORKERS_OPTIONS_PREFIX,
nullptr)) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
JSVersionChanged,
PREF_WORKERS_LATEST_JS_VERSION,
@ -1846,10 +1845,10 @@ RuntimeService::Cleanup()
if (NS_FAILED(Preferences::UnregisterCallback(JSVersionChanged,
PREF_WORKERS_LATEST_JS_VERSION,
nullptr)) ||
NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions,
NS_FAILED(Preferences::UnregisterCallback(LoadRuntimeAndContextOptions,
PREF_JS_OPTIONS_PREFIX,
nullptr)) ||
NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions,
NS_FAILED(Preferences::UnregisterCallback(LoadRuntimeAndContextOptions,
PREF_WORKERS_OPTIONS_PREFIX,
nullptr)) ||
#if DUMP_CONTROLLED_BY_PREF
@ -2231,9 +2230,10 @@ RuntimeService::NoteIdleThread(WorkerThread* aThread)
}
void
RuntimeService::UpdateAllWorkerJSContextOptions()
RuntimeService::UpdateAllWorkerRuntimeAndContextOptions()
{
BROADCAST_ALL_WORKERS(UpdateJSContextOptions,
BROADCAST_ALL_WORKERS(UpdateRuntimeAndContextOptions,
sDefaultJSSettings.runtimeOptions,
sDefaultJSSettings.content.contextOptions,
sDefaultJSSettings.chrome.contextOptions);
}

Просмотреть файл

@ -174,16 +174,19 @@ public:
}
static void
SetDefaultJSContextOptions(const JS::ContextOptions& aContentOptions,
const JS::ContextOptions& aChromeOptions)
SetDefaultRuntimeAndContextOptions(
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions)
{
AssertIsOnMainThread();
sDefaultJSSettings.content.contextOptions = aContentOptions;
sDefaultJSSettings.chrome.contextOptions = aChromeOptions;
sDefaultJSSettings.runtimeOptions = aRuntimeOptions;
sDefaultJSSettings.content.contextOptions = aContentCxOptions;
sDefaultJSSettings.chrome.contextOptions = aChromeCxOptions;
}
void
UpdateAllWorkerJSContextOptions();
UpdateAllWorkerRuntimeAndContextOptions();
void
UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue);

Просмотреть файл

@ -1515,25 +1515,32 @@ private:
}
};
class UpdateJSContextOptionsRunnable MOZ_FINAL : public WorkerControlRunnable
class UpdateRuntimeAndContextOptionsRunnable MOZ_FINAL : public WorkerControlRunnable
{
JS::ContextOptions mContentOptions;
JS::ContextOptions mChromeOptions;
JS::RuntimeOptions mRuntimeOptions;
JS::ContextOptions mContentCxOptions;
JS::ContextOptions mChromeCxOptions;
public:
UpdateJSContextOptionsRunnable(WorkerPrivate* aWorkerPrivate,
const JS::ContextOptions& aContentOptions,
const JS::ContextOptions& aChromeOptions)
UpdateRuntimeAndContextOptionsRunnable(
WorkerPrivate* aWorkerPrivate,
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions)
: WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
mContentOptions(aContentOptions), mChromeOptions(aChromeOptions)
mRuntimeOptions(aRuntimeOptions),
mContentCxOptions(aContentCxOptions),
mChromeCxOptions(aChromeCxOptions)
{ }
private:
virtual bool
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) MOZ_OVERRIDE
{
aWorkerPrivate->UpdateJSContextOptionsInternal(aCx, mContentOptions,
mChromeOptions);
aWorkerPrivate->UpdateRuntimeAndContextOptionsInternal(aCx,
mRuntimeOptions,
mContentCxOptions,
mChromeCxOptions);
return true;
}
};
@ -2843,22 +2850,26 @@ WorkerPrivateParent<Derived>::GetInnerWindowId()
template <class Derived>
void
WorkerPrivateParent<Derived>::UpdateJSContextOptions(
JSContext* aCx,
const JS::ContextOptions& aContentOptions,
const JS::ContextOptions& aChromeOptions)
WorkerPrivateParent<Derived>::UpdateRuntimeAndContextOptions(
JSContext* aCx,
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions)
{
AssertIsOnParentThread();
{
MutexAutoLock lock(mMutex);
mJSSettings.content.contextOptions = aContentOptions;
mJSSettings.chrome.contextOptions = aChromeOptions;
mJSSettings.runtimeOptions = aRuntimeOptions;
mJSSettings.content.contextOptions = aContentCxOptions;
mJSSettings.chrome.contextOptions = aChromeCxOptions;
}
nsRefPtr<UpdateJSContextOptionsRunnable> runnable =
new UpdateJSContextOptionsRunnable(ParentAsWorkerPrivate(), aContentOptions,
aChromeOptions);
nsRefPtr<UpdateRuntimeAndContextOptionsRunnable> runnable =
new UpdateRuntimeAndContextOptionsRunnable(ParentAsWorkerPrivate(),
aRuntimeOptions,
aContentCxOptions,
aChromeCxOptions);
if (!runnable->Dispatch(aCx)) {
NS_WARNING("Failed to update worker context options!");
JS_ClearPendingException(aCx);
@ -5503,17 +5514,21 @@ WorkerPrivate::RescheduleTimeoutTimer(JSContext* aCx)
}
void
WorkerPrivate::UpdateJSContextOptionsInternal(JSContext* aCx,
const JS::ContextOptions& aContentOptions,
const JS::ContextOptions& aChromeOptions)
WorkerPrivate::UpdateRuntimeAndContextOptionsInternal(
JSContext* aCx,
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions)
{
AssertIsOnWorkerThread();
JS::ContextOptionsRef(aCx) = IsChromeWorker() ? aChromeOptions : aContentOptions;
JS::RuntimeOptionsRef(aCx) = aRuntimeOptions;
JS::ContextOptionsRef(aCx) = IsChromeWorker() ? aChromeCxOptions : aContentCxOptions;
for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
mChildWorkers[index]->UpdateJSContextOptions(aCx, aContentOptions,
aChromeOptions);
mChildWorkers[index]->UpdateRuntimeAndContextOptions(aCx, aRuntimeOptions,
aContentCxOptions,
aChromeCxOptions);
}
}

Просмотреть файл

@ -389,8 +389,10 @@ public:
GetInnerWindowId();
void
UpdateJSContextOptions(JSContext* aCx, const JS::ContextOptions& aChromeOptions,
const JS::ContextOptions& aContentOptions);
UpdateRuntimeAndContextOptions(JSContext* aCx,
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions);
void
UpdatePreference(JSContext* aCx, WorkerPreference aPref, bool aValue);
@ -906,8 +908,11 @@ public:
}
void
UpdateJSContextOptionsInternal(JSContext* aCx, const JS::ContextOptions& aContentOptions,
const JS::ContextOptions& aChromeOptions);
UpdateRuntimeAndContextOptionsInternal(
JSContext* aCx,
const JS::RuntimeOptions& aRuntimeOptions,
const JS::ContextOptions& aContentCxOptions,
const JS::ContextOptions& aChromeCxOptions);
void
UpdatePreferenceInternal(JSContext* aCx, WorkerPreference aPref, bool aValue);

Просмотреть файл

@ -107,6 +107,7 @@ struct JSSettings
JSContentChromeSettings chrome;
JSContentChromeSettings content;
JSGCSettingsArray gcSettings;
JS::RuntimeOptions runtimeOptions;
#ifdef JS_GC_ZEAL
uint8_t gcZeal;

Просмотреть файл

@ -347,6 +347,13 @@ public:
{
}
#ifdef DEBUG
virtual ~DataSourceSurface()
{
MOZ_ASSERT(!mIsMapped, "Someone forgot to call Unmap()");
}
#endif
struct MappedSurface {
uint8_t *mData;
int32_t mStride;

Просмотреть файл

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "2D.h"
#include "DataSurfaceHelpers.h"
namespace mozilla {
namespace gfx {
void
ConvertBGRXToBGRA(uint8_t* aData, const IntSize &aSize, int32_t aStride)
{
uint32_t* pixel = reinterpret_cast<uint32_t*>(aData);
for (int row = 0; row < aSize.height; ++row) {
for (int column = 0; column < aSize.width; ++column) {
#ifdef IS_BIG_ENDIAN
pixel[column] |= 0x000000FF;
#else
pixel[column] |= 0xFF000000;
#endif
}
pixel += (aStride/4);
}
}
void
CopySurfaceDataToPackedArray(uint8_t* aSrc, uint8_t* aDst, IntSize aSrcSize,
int32_t aSrcStride, int32_t aBytesPerPixel)
{
MOZ_ASSERT(aBytesPerPixel > 0,
"Negative stride for aDst not currently supported");
int packedStride = aSrcSize.width * aBytesPerPixel;
if (aSrcStride == packedStride) {
// aSrc is already packed, so we can copy with a single memcpy.
memcpy(aDst, aSrc, packedStride * aSrcSize.height);
} else {
// memcpy one row at a time.
for (int row = 0; row < aSrcSize.height; ++row) {
memcpy(aDst, aSrc, packedStride);
aSrc += aSrcStride;
aDst += packedStride;
}
}
}
uint8_t*
SurfaceToPackedBGRA(DataSourceSurface *aSurface)
{
SurfaceFormat format = aSurface->GetFormat();
if (format != SurfaceFormat::B8G8R8A8 && format != SurfaceFormat::B8G8R8X8) {
return nullptr;
}
IntSize size = aSurface->GetSize();
uint8_t* imageBuffer = new (std::nothrow) uint8_t[size.width * size.height * sizeof(uint32_t)];
if (!imageBuffer) {
return nullptr;
}
DataSourceSurface::MappedSurface map;
if (!aSurface->Map(DataSourceSurface::MapType::READ, &map)) {
delete [] imageBuffer;
return nullptr;
}
CopySurfaceDataToPackedArray(map.mData, imageBuffer, size,
map.mStride, 4 * sizeof(uint8_t));
aSurface->Unmap();
if (format == SurfaceFormat::B8G8R8X8) {
// Convert BGRX to BGRA by setting a to 255.
ConvertBGRXToBGRA(reinterpret_cast<uint8_t *>(imageBuffer), size, size.width * sizeof(uint32_t));
}
return imageBuffer;
}
}
}

Просмотреть файл

@ -10,66 +10,25 @@
namespace mozilla {
namespace gfx {
static inline void
ConvertBGRXToBGRA(uint8_t* aData, const IntSize &aSize, int32_t aStride)
{
uint32_t* pixel = reinterpret_cast<uint32_t*>(aData);
void
ConvertBGRXToBGRA(uint8_t* aData, const IntSize &aSize, int32_t aStride);
for (int row = 0; row < aSize.height; ++row) {
for (int column = 0; column < aSize.width; ++column) {
#ifdef IS_BIG_ENDIAN
pixel[column] |= 0x000000FF;
#else
pixel[column] |= 0xFF000000;
#endif
}
pixel += (aStride/4);
}
}
/**
* Copy the pixel data from aSrc and pack it into aDst. aSrcSize, aSrcStride
* and aBytesPerPixel give the size, stride and bytes per pixel for aSrc's
* surface. Callers are responsible for making sure that aDst is big enough to
* contain |aSrcSize.width * aSrcSize.height * aBytesPerPixel| bytes.
*/
void
CopySurfaceDataToPackedArray(uint8_t* aSrc, uint8_t* aDst, IntSize aSrcSize,
int32_t aSrcStride, int32_t aBytesPerPixel);
/**
* Convert aSurface to a packed buffer in BGRA format. The pixel data is
* returned in a buffer allocated with new uint8_t[].
*/
inline uint8_t *
SurfaceToPackedBGRA(DataSourceSurface *aSurface)
{
SurfaceFormat format = aSurface->GetFormat();
if (format != SurfaceFormat::B8G8R8A8 && format != SurfaceFormat::B8G8R8X8) {
return nullptr;
}
IntSize size = aSurface->GetSize();
uint8_t* imageBuffer = new (std::nothrow) uint8_t[size.width * size.height * sizeof(uint32_t)];
if (!imageBuffer) {
return nullptr;
}
size_t stride = aSurface->Stride();
uint32_t* src = reinterpret_cast<uint32_t*>(aSurface->GetData());
uint32_t* dst = reinterpret_cast<uint32_t*>(imageBuffer);
if (stride == size.width * sizeof(uint32_t)) {
// DataSourceSurface is already packed. We can use memcpy.
memcpy(dst, src, size.width * size.height * sizeof(uint32_t));
} else {
for (int row = 0; row < size.height; ++row) {
for (int column = 0; column < size.width; ++column) {
*dst++ = src[column];
}
src += (stride/4);
}
}
if (format == SurfaceFormat::B8G8R8X8) {
// Convert BGRX to BGRA by setting a to 255.
ConvertBGRXToBGRA(reinterpret_cast<uint8_t *>(imageBuffer), size, size.width * sizeof(uint32_t));
}
return imageBuffer;
}
uint8_t*
SurfaceToPackedBGRA(DataSourceSurface *aSurface);
}
}

Просмотреть файл

@ -167,6 +167,9 @@ DataSourceSurfaceD2D1::Map(MapType aMapType, MappedSurface *aMappedSurface)
void
DataSourceSurfaceD2D1::Unmap()
{
MOZ_ASSERT(mIsMapped);
mIsMapped = false;
mBitmap->Unmap();
}

Просмотреть файл

@ -273,6 +273,7 @@ DataSourceSurfaceD2DTarget::Map(MapType aMapType, MappedSurface *aMappedSurface)
aMappedSurface->mData = (uint8_t*)map.pData;
aMappedSurface->mStride = map.RowPitch;
mIsMapped = true;
return true;
}
@ -282,6 +283,7 @@ DataSourceSurfaceD2DTarget::Unmap()
{
MOZ_ASSERT(mIsMapped);
mIsMapped = false;
mTexture->Unmap(0);
}

Просмотреть файл

@ -102,6 +102,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
UNIFIED_SOURCES += [
'Blur.cpp',
'DataSourceSurface.cpp',
'DataSurfaceHelpers.cpp',
'DrawEventRecorder.cpp',
'DrawTargetCairo.cpp',
'DrawTargetDual.cpp',

Просмотреть файл

@ -490,6 +490,7 @@ GLScreenBuffer::Readback(SharedSurface_GL* src, DataSourceSurface* dest)
ms.mStride,
SurfaceFormatToImageFormat(dest->GetFormat()));
DeprecatedReadback(src, wrappedDest);
dest->Unmap();
}
void

Просмотреть файл

@ -619,8 +619,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mPresShellId);
WriteParam(aMsg, aParam.mIsRoot);
WriteParam(aMsg, aParam.mHasScrollgrab);
WriteParam(aMsg, aParam.mDisableScrollingX);
WriteParam(aMsg, aParam.mDisableScrollingY);
WriteParam(aMsg, aParam.mUpdateScrollOffset);
WriteParam(aMsg, aParam.mScrollGeneration);
WriteParam(aMsg, aParam.mContentDescription);
@ -643,8 +641,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
ReadParam(aMsg, aIter, &aResult->mIsRoot) &&
ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) &&
ReadParam(aMsg, aIter, &aResult->mDisableScrollingX) &&
ReadParam(aMsg, aIter, &aResult->mDisableScrollingY) &&
ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) &&
ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
ReadParam(aMsg, aIter, &aResult->mContentDescription));

Просмотреть файл

@ -62,8 +62,6 @@ public:
, mMayHaveTouchListeners(false)
, mIsRoot(false)
, mHasScrollgrab(false)
, mDisableScrollingX(false)
, mDisableScrollingY(false)
, mUpdateScrollOffset(false)
, mScrollGeneration(0)
{}
@ -88,8 +86,6 @@ public:
mPresShellId == aOther.mPresShellId &&
mIsRoot == aOther.mIsRoot &&
mHasScrollgrab == aOther.mHasScrollgrab &&
mDisableScrollingX == aOther.mDisableScrollingX &&
mDisableScrollingY == aOther.mDisableScrollingY &&
mUpdateScrollOffset == aOther.mUpdateScrollOffset;
}
bool operator!=(const FrameMetrics& aOther) const
@ -304,26 +300,6 @@ public:
bool mHasScrollgrab;
public:
bool GetDisableScrollingX() const
{
return mDisableScrollingX;
}
void SetDisableScrollingX(bool aDisableScrollingX)
{
mDisableScrollingX = aDisableScrollingX;
}
bool GetDisableScrollingY() const
{
return mDisableScrollingY;
}
void SetDisableScrollingY(bool aDisableScrollingY)
{
mDisableScrollingY = aDisableScrollingY;
}
void SetScrollOffsetUpdated(uint32_t aScrollGeneration)
{
mUpdateScrollOffset = true;
@ -354,11 +330,6 @@ private:
// New fields from now on should be made private and old fields should
// be refactored to be private.
// Allow disabling scrolling in individual axis to support
// |overflow: hidden|.
bool mDisableScrollingX;
bool mDisableScrollingY;
// Whether mScrollOffset was updated by something other than the APZ code, and
// if the APZC receiving this metrics should update its local copy.
bool mUpdateScrollOffset;

Просмотреть файл

@ -353,7 +353,9 @@ GrallocImage::GetAsSourceSurface()
surface->Unmap();
return surface;
} else if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) {
}
if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) {
uint32_t uvOffset = height * width;
ConvertYVU420SPToRGB565(buffer, width,
buffer + uvOffset, width,
@ -362,12 +364,15 @@ GrallocImage::GetAsSourceSurface()
surface->Unmap();
return surface;
} else if (format == HAL_PIXEL_FORMAT_YV12) {
}
if (format == HAL_PIXEL_FORMAT_YV12) {
gfx::ConvertYCbCrToRGB(mData,
surface->GetFormat(),
mSize,
surface->GetData(),
surface->Stride());
surface->Unmap();
return surface;
}
@ -376,6 +381,7 @@ GrallocImage::GetAsSourceSurface()
if (!colorConverter.isValid()) {
NS_WARNING("Invalid color conversion");
surface->Unmap();
return nullptr;
}

Просмотреть файл

@ -288,11 +288,11 @@ static bool gCrossSlideEnabled = false;
static bool gAllowCheckerboarding = true;
/**
* Pref that enables enlarging of the displayport along one axis when its
* opposite's scrollable rect is within the composition bounds. That is, we
* don't need to pad the opposite axis.
* Pref that enables enlarging of the displayport along one axis when the
* generated displayport's size is beyond that of the scrollable rect on the
* opposite axis.
*/
static bool gEnlargeDisplayPortWhenOnlyScrollable = false;
static bool gEnlargeDisplayPortWhenClipped = false;
/**
* Is aAngle within the given threshold of the horizontal axis?
@ -419,8 +419,8 @@ AsyncPanZoomController::InitializeGlobalState()
Preferences::AddBoolVarCache(&gCrossSlideEnabled, "apz.cross_slide.enabled", gCrossSlideEnabled);
Preferences::AddIntVarCache(&gAxisLockMode, "apz.axis_lock_mode", gAxisLockMode);
Preferences::AddBoolVarCache(&gAllowCheckerboarding, "apz.allow-checkerboarding", gAllowCheckerboarding);
Preferences::AddBoolVarCache(&gEnlargeDisplayPortWhenOnlyScrollable, "apz.enlarge_displayport_when_only_scrollable",
gEnlargeDisplayPortWhenOnlyScrollable);
Preferences::AddBoolVarCache(&gEnlargeDisplayPortWhenClipped, "apz.enlarge_displayport_when_clipped",
gEnlargeDisplayPortWhenClipped);
gComputedTimingFunction = new ComputedTimingFunction();
gComputedTimingFunction->Init(
@ -792,7 +792,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
return nsEventStatus_eIgnore;
}
if (!AllowZoom()) {
if (!mZoomConstraints.mAllowZoom) {
return nsEventStatus_eConsumeNoDefault;
}
@ -952,7 +952,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
// If mZoomConstraints.mAllowDoubleTapZoom is true we wait for a call to OnSingleTapConfirmed before
// sending event to content
if (controller && !AllowDoubleTapZoom()) {
if (controller && !mZoomConstraints.mAllowDoubleTapZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
@ -993,7 +993,7 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
APZC_LOG("%p got a double-tap in state %d\n", this, mState);
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
if (AllowDoubleTapZoom()) {
if (mZoomConstraints.mAllowDoubleTapZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSIntPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
@ -1155,11 +1155,9 @@ void AsyncPanZoomController::AttemptScroll(const ScreenPoint& aStartPoint,
CSSPoint cssOverscroll;
gfx::Point scrollOffset(mX.AdjustDisplacement(cssDisplacement.x,
cssOverscroll.x,
mFrameMetrics.GetDisableScrollingX()),
cssOverscroll.x),
mY.AdjustDisplacement(cssDisplacement.y,
cssOverscroll.y,
mFrameMetrics.GetDisableScrollingY()));
cssOverscroll.y));
overscroll = cssOverscroll * zoom;
if (fabs(scrollOffset.x) > EPSILON || fabs(scrollOffset.y) > EPSILON) {
@ -1255,10 +1253,8 @@ bool FlingAnimation::Sample(FrameMetrics& aFrameMetrics,
// a larger swipe should move you a shorter distance).
CSSPoint cssOffset = offset / aFrameMetrics.mZoom;
aFrameMetrics.mScrollOffset += CSSPoint::FromUnknownPoint(gfx::Point(
mX.AdjustDisplacement(cssOffset.x, overscroll.x,
aFrameMetrics.GetDisableScrollingX()),
mY.AdjustDisplacement(cssOffset.y, overscroll.y,
aFrameMetrics.GetDisableScrollingY())
mX.AdjustDisplacement(cssOffset.x, overscroll.x),
mY.AdjustDisplacement(cssOffset.y, overscroll.y)
));
return true;
@ -1301,31 +1297,46 @@ void AsyncPanZoomController::ScaleWithFocus(float aScale,
}
/**
* Attempts to enlarge the displayport along a single axis based on the
* velocity. aOffset and aLength are in/out parameters; they are initially set
* to the currently visible area and will be transformed to the area we should
* be drawing to minimize checkerboarding.
* Enlarges the displayport along both axes based on the velocity.
*/
static CSSSize
CalculateDisplayPortSize(const CSSRect& aCompositionBounds,
const CSSPoint& aVelocity)
{
float xMultiplier = fabsf(aVelocity.x) < gMinSkateSpeed
? gXStationarySizeMultiplier
: gXSkateSizeMultiplier;
float yMultiplier = fabsf(aVelocity.y) < gMinSkateSpeed
? gYStationarySizeMultiplier
: gYSkateSizeMultiplier;
return CSSSize(aCompositionBounds.width * xMultiplier,
aCompositionBounds.height * yMultiplier);
}
/**
* Attempts to redistribute any area in the displayport that would get clipped
* by the scrollable rect, or be inaccessible due to disabled scrolling, to the
* other axis, while maintaining total displayport area.
*/
static void
EnlargeDisplayPortAlongAxis(float* aOutOffset, float* aOutLength,
double aEstimatedPaintDurationMillis, float aVelocity,
float aStationarySizeMultiplier, float aSkateSizeMultiplier)
RedistributeDisplayPortExcess(CSSSize& aDisplayPortSize,
const CSSRect& aCompositionBounds,
const CSSRect& aScrollableRect)
{
// Scale up the length using the appropriate multiplier and center the
// displayport around the visible area.
float multiplier = (fabsf(aVelocity) < gMinSkateSpeed
? aStationarySizeMultiplier
: aSkateSizeMultiplier);
float newLength = (*aOutLength) * multiplier;
*aOutOffset -= (newLength - (*aOutLength)) / 2;
*aOutLength = newLength;
float xSlack = std::max(0.0f, aDisplayPortSize.width - aScrollableRect.width);
float ySlack = std::max(0.0f, aDisplayPortSize.height - aScrollableRect.height);
// Project the displayport out based on the estimated time it will take to paint,
// if the gUsePaintDuration flag is set. If not, just use a constant 50ms paint
// time. Setting the gVelocityBias pref appropriately can cancel this out if so
// desired.
double paintFactor = (gUsePaintDuration ? aEstimatedPaintDurationMillis : 50.0);
*aOutOffset += (aVelocity * paintFactor * gVelocityBias);
if (ySlack > 0) {
// Reassign wasted y-axis displayport to the x-axis
aDisplayPortSize.height -= ySlack;
float xExtra = ySlack * aDisplayPortSize.width / aDisplayPortSize.height;
aDisplayPortSize.width += xExtra;
} else if (xSlack > 0) {
// Reassign wasted x-axis displayport to the y-axis
aDisplayPortSize.width -= xSlack;
float yExtra = xSlack * aDisplayPortSize.height / aDisplayPortSize.width;
aDisplayPortSize.height += yExtra;
}
}
/* static */
@ -1334,57 +1345,30 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
const ScreenPoint& aVelocity,
double aEstimatedPaintDuration)
{
// convert to milliseconds
double estimatedPaintDurationMillis = aEstimatedPaintDuration * 1000;
CSSRect compositionBounds = aFrameMetrics.CalculateCompositedRectInCssPixels();
CSSPoint scrollOffset = aFrameMetrics.mScrollOffset;
CSSRect displayPort(scrollOffset, compositionBounds.Size());
CSSPoint velocity = aVelocity / aFrameMetrics.mZoom;
CSSPoint scrollOffset = aFrameMetrics.mScrollOffset;
CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
float xSkateSizeMultiplier = gXSkateSizeMultiplier,
ySkateSizeMultiplier = gYSkateSizeMultiplier;
// Calculate the displayport size based on how fast we're moving along each axis.
CSSSize displayPortSize = CalculateDisplayPortSize(compositionBounds, velocity);
if (gEnlargeDisplayPortWhenOnlyScrollable) {
// Check if the displayport, without being enlarged, fits tightly inside the
// scrollable rect. If so, we're not going to be able to enlarge it, so we
// should consider enlarging the opposite axis.
if (scrollableRect.width - compositionBounds.width <= EPSILON ||
aFrameMetrics.GetDisableScrollingX()) {
xSkateSizeMultiplier = 1.f;
ySkateSizeMultiplier = gYStationarySizeMultiplier;
}
// Even if we end up overwriting the previous multipliers, it doesn't
// matter, since this frame's scrollable rect fits within its composition
// bounds on both axes and we won't be enlarging either displayport axis.
if (scrollableRect.height - compositionBounds.height <= EPSILON ||
aFrameMetrics.GetDisableScrollingY()) {
ySkateSizeMultiplier = 1.f;
xSkateSizeMultiplier = gXSkateSizeMultiplier;
}
if (gEnlargeDisplayPortWhenClipped) {
RedistributeDisplayPortExcess(displayPortSize, compositionBounds, scrollableRect);
}
// If scrolling is disabled here then our actual velocity is going
// to be zero, so treat the displayport accordingly.
if (aFrameMetrics.GetDisableScrollingX()) {
velocity.x = 0;
}
if (aFrameMetrics.GetDisableScrollingY()) {
velocity.y = 0;
}
// Offset the displayport, depending on how fast we're moving and the
// estimated time it takes to paint, to try to minimise checkerboarding.
float estimatedPaintDurationMillis = (float)(aEstimatedPaintDuration * 1000.0);
float paintFactor = (gUsePaintDuration ? estimatedPaintDurationMillis : 50.0f);
CSSRect displayPort = CSSRect(scrollOffset + (velocity * paintFactor * gVelocityBias),
displayPortSize);
// Enlarge the displayport along both axes depending on how fast we're moving
// on that axis and how long it takes to paint. Apply some heuristics to try
// to minimize checkerboarding.
EnlargeDisplayPortAlongAxis(&(displayPort.x), &(displayPort.width),
estimatedPaintDurationMillis, velocity.x,
gXStationarySizeMultiplier, xSkateSizeMultiplier);
EnlargeDisplayPortAlongAxis(&(displayPort.y), &(displayPort.height),
estimatedPaintDurationMillis, velocity.y,
gYStationarySizeMultiplier, ySkateSizeMultiplier);
// Re-center the displayport based on its expansion over the composition bounds.
displayPort.MoveBy((compositionBounds.width - displayPort.width)/2.0f,
(compositionBounds.height - displayPort.height)/2.0f);
// Make sure the displayport remains within the scrollable rect.
displayPort = displayPort.ForceInside(scrollableRect) - scrollOffset;
APZC_LOG_FM(aFrameMetrics,
@ -1691,8 +1675,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
mFrameMetrics.mResolution = aLayerMetrics.mResolution;
mFrameMetrics.mCumulativeResolution = aLayerMetrics.mCumulativeResolution;
mFrameMetrics.mHasScrollgrab = aLayerMetrics.mHasScrollgrab;
mFrameMetrics.SetDisableScrollingX(aLayerMetrics.GetDisableScrollingX());
mFrameMetrics.SetDisableScrollingY(aLayerMetrics.GetDisableScrollingY());
// If the layers update was not triggered by our own repaint request, then
// we want to take the new scroll offset.
@ -1946,19 +1928,6 @@ bool AsyncPanZoomController::IsPanningState(PanZoomState aState) {
return (aState == PANNING || aState == PANNING_LOCKED_X || aState == PANNING_LOCKED_Y);
}
bool AsyncPanZoomController::AllowZoom() {
// In addition to looking at the zoom constraints, which comes from the meta
// viewport tag, disallow zooming if we are overflow:hidden in either direction.
ReentrantMonitorAutoEnter lock(mMonitor);
return mZoomConstraints.mAllowZoom
&& !(mFrameMetrics.GetDisableScrollingX() || mFrameMetrics.GetDisableScrollingY());
}
bool AsyncPanZoomController::AllowDoubleTapZoom() {
ReentrantMonitorAutoEnter lock(mMonitor);
return mZoomConstraints.mAllowDoubleTapZoom && AllowZoom();
}
void AsyncPanZoomController::SetContentResponseTimer() {
if (!mContentResponseTimeoutTask) {
mContentResponseTimeoutTask =

Просмотреть файл

@ -599,9 +599,6 @@ private:
bool IsTransformingState(PanZoomState aState);
bool IsPanningState(PanZoomState mState);
bool AllowZoom();
bool AllowDoubleTapZoom();
enum AxisLockMode {
FREE, /* No locking at all */
STANDARD, /* Default axis locking mode that remains locked until pan ends*/

Просмотреть файл

@ -103,19 +103,12 @@ void Axis::StartTouch(int32_t aPos) {
mAxisLocked = false;
}
float Axis::AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut,
bool aScrollingDisabled) {
float Axis::AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut) {
if (mAxisLocked) {
aOverscrollAmountOut = 0;
return 0;
}
if (aScrollingDisabled) {
// Scrolling is disabled on this axis, stop scrolling.
aOverscrollAmountOut = aDisplacement;
return 0;
}
float displacement = aDisplacement;
// If this displacement will cause an overscroll, throttle it. Can potentially

Просмотреть файл

@ -76,12 +76,8 @@ public:
* (which might prevent any displacement from happening). If overscroll
* ocurred, its amount is written to |aOverscrollAmountOut|.
* The adjusted displacement is returned.
*
* aScrollingDisabled is used to indicate that no scrolling should happen
* in this axis. This is used to implement overflow: hidden;
*/
float AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut,
bool aScrollingDisabled);
float AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut);
/**
* Gets the distance between the starting position of the touch supplied in

Просмотреть файл

@ -134,9 +134,9 @@ static nsresult EncodeImageData(DataSourceSurface* aDataSurface,
return NS_IMAGELIB_ERROR_NO_ENCODER;
DataSourceSurface::MappedSurface map;
aDataSurface->Map(DataSourceSurface::MapType::READ, &map);
if (!map.mData)
if (!aDataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
return NS_ERROR_FAILURE;
}
IntSize size = aDataSurface->GetSize();
uint32_t dataLength = map.mStride * size.height;
@ -149,7 +149,7 @@ static nsresult EncodeImageData(DataSourceSurface* aDataSurface,
map.mStride,
imgIEncoder::INPUT_FORMAT_HOSTARGB,
aOutputOptions);
aDataSurface->Unmap();
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(encoder, aStream);
@ -204,9 +204,9 @@ NS_IMETHODIMP imgTools::EncodeScaledImage(imgIContainer *aContainer,
Factory::CreateDataSourceSurface(IntSize(aScaledWidth, aScaledHeight),
SurfaceFormat::B8G8R8A8);
DataSourceSurface::MappedSurface map;
dataSurface->Map(DataSourceSurface::MapType::WRITE, &map);
if (!map.mData)
if (!dataSurface->Map(DataSourceSurface::MapType::WRITE, &map)) {
return NS_ERROR_FAILURE;
}
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
@ -220,6 +220,8 @@ NS_IMETHODIMP imgTools::EncodeScaledImage(imgIContainer *aContainer,
DrawSurfaceOptions(),
DrawOptions(1.0f, CompositionOp::OP_SOURCE));
dataSurface->Unmap();
return EncodeImageData(dataSurface, aMimeType, aOutputOptions, aStream);
}
@ -267,9 +269,9 @@ NS_IMETHODIMP imgTools::EncodeCroppedImage(imgIContainer *aContainer,
Factory::CreateDataSourceSurface(IntSize(aWidth, aHeight),
SurfaceFormat::B8G8R8A8);
DataSourceSurface::MappedSurface map;
dataSurface->Map(DataSourceSurface::MapType::WRITE, &map);
if (!map.mData)
if (!dataSurface->Map(DataSourceSurface::MapType::WRITE, &map)) {
return NS_ERROR_FAILURE;
}
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
@ -281,6 +283,8 @@ NS_IMETHODIMP imgTools::EncodeCroppedImage(imgIContainer *aContainer,
IntRect(aOffsetX, aOffsetY, aWidth, aHeight),
IntPoint(0, 0));
dataSurface->Unmap();
return EncodeImageData(dataSurface, aMimeType, aOutputOptions, aStream);
}

Просмотреть файл

@ -1656,11 +1656,7 @@ jsdContext::GetJSContext(JSContext **_rval)
#define JSOPTION_DONT_REPORT_UNCAUGHT JS_BIT(8)
#define JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT JS_BIT(11)
#define JSOPTION_NO_SCRIPT_RVAL JS_BIT(12)
#define JSOPTION_BASELINE JS_BIT(14)
#define JSOPTION_TYPE_INFERENCE JS_BIT(16)
#define JSOPTION_STRICT_MODE JS_BIT(17)
#define JSOPTION_ION JS_BIT(18)
#define JSOPTION_ASMJS JS_BIT(19)
#define JSOPTION_MASK JS_BITMASK(20)
NS_IMETHODIMP
@ -1674,11 +1670,7 @@ jsdContext::GetOptions(uint32_t *_rval)
| (JS::ContextOptionsRef(mJSCx).dontReportUncaught() ? JSOPTION_DONT_REPORT_UNCAUGHT : 0)
| (JS::ContextOptionsRef(mJSCx).noDefaultCompartmentObject() ? JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT : 0)
| (JS::ContextOptionsRef(mJSCx).noScriptRval() ? JSOPTION_NO_SCRIPT_RVAL : 0)
| (JS::ContextOptionsRef(mJSCx).strictMode() ? JSOPTION_STRICT_MODE : 0)
| (JS::ContextOptionsRef(mJSCx).baseline() ? JSOPTION_BASELINE : 0)
| (JS::ContextOptionsRef(mJSCx).typeInference() ? JSOPTION_TYPE_INFERENCE : 0)
| (JS::ContextOptionsRef(mJSCx).ion() ? JSOPTION_ION : 0)
| (JS::ContextOptionsRef(mJSCx).asmJS() ? JSOPTION_ASMJS : 0);
| (JS::ContextOptionsRef(mJSCx).strictMode() ? JSOPTION_STRICT_MODE : 0);
return NS_OK;
}
@ -1699,11 +1691,7 @@ jsdContext::SetOptions(uint32_t options)
.setDontReportUncaught(options & JSOPTION_DONT_REPORT_UNCAUGHT)
.setNoDefaultCompartmentObject(options & JSOPTION_NO_DEFAULT_COMPARTMENT_OBJECT)
.setNoScriptRval(options & JSOPTION_NO_SCRIPT_RVAL)
.setStrictMode(options & JSOPTION_STRICT_MODE)
.setBaseline(options & JSOPTION_BASELINE)
.setTypeInference(options & JSOPTION_TYPE_INFERENCE)
.setIon(options & JSOPTION_ION)
.setAsmJS(options & JSOPTION_ASMJS);
.setStrictMode(options & JSOPTION_STRICT_MODE);
return NS_OK;
}

Просмотреть файл

@ -1160,7 +1160,7 @@ SetJitCompilerOption(JSContext *cx, unsigned argc, jsval *vp)
if (number < 0)
number = -1;
JS_SetGlobalJitCompilerOption(cx, opt, uint32_t(number));
JS_SetGlobalJitCompilerOption(cx->runtime(), opt, uint32_t(number));
args.rval().setUndefined();
return true;
@ -1175,10 +1175,10 @@ GetJitCompilerOptions(JSContext *cx, unsigned argc, jsval *vp)
RootedValue value(cx);
#define JIT_COMPILER_MATCH(key, string) \
opt = JSJITCOMPILER_ ## key; \
value.setInt32(JS_GetGlobalJitCompilerOption(cx, opt)); \
if (!JS_SetProperty(cx, info, string, value)) \
#define JIT_COMPILER_MATCH(key, string) \
opt = JSJITCOMPILER_ ## key; \
value.setInt32(JS_GetGlobalJitCompilerOption(cx->runtime(), opt)); \
if (!JS_SetProperty(cx, info, string, value)) \
return false;
JSJitCompilerOption opt = JSJITCOMPILER_NOT_AN_OPTION;

Просмотреть файл

@ -62,7 +62,6 @@ MarkExactStackRoot(JSTracer *trc, Rooted<void*> *rooter, ThingRootKind kind)
case THING_ROOT_JIT_CODE: MarkJitCodeRoot(trc, (jit::JitCode **)addr, "exact-jitcode"); break;
case THING_ROOT_VALUE: MarkValueRoot(trc, (Value *)addr, "exact-value"); break;
case THING_ROOT_ID: MarkIdRoot(trc, (jsid *)addr, "exact-id"); break;
case THING_ROOT_PROPERTY_ID: MarkIdRoot(trc, &((js::PropertyId *)addr)->asId(), "exact-propertyid"); break;
case THING_ROOT_BINDINGS: ((Bindings *)addr)->trace(trc); break;
case THING_ROOT_PROPERTY_DESCRIPTOR: ((JSPropertyDescriptor *)addr)->trace(trc); break;
case THING_ROOT_CUSTOM: {

Просмотреть файл

@ -7028,7 +7028,7 @@ js::IsAsmJSCompilationAvailable(JSContext *cx, unsigned argc, Value *vp)
cx->signalHandlersInstalled() &&
cx->gcSystemPageSize() == AsmJSPageSize &&
!cx->compartment()->debugMode() &&
cx->compartment()->options().asmJS(cx);
cx->runtime()->options().asmJS();
args.rval().set(BooleanValue(available));
return true;

Просмотреть файл

@ -312,7 +312,7 @@ struct BaselineScript
inline bool
IsBaselineEnabled(JSContext *cx)
{
return cx->compartment()->options().baseline(cx);
return cx->runtime()->options().baseline();
}
MethodStatus

Просмотреть файл

@ -159,8 +159,8 @@ void StopAllOffThreadCompilations(JSCompartment *comp);
static inline bool
IsIonEnabled(JSContext *cx)
{
return cx->compartment()->options().ion(cx) &&
cx->compartment()->options().baseline(cx) &&
return cx->runtime()->options().ion() &&
cx->runtime()->options().baseline() &&
cx->typeInferenceEnabled();
}

Просмотреть файл

@ -133,7 +133,7 @@ JSContext *createContext()
JSContext *cx = JSAPITest::createContext();
if (!cx)
return nullptr;
JS::ContextOptionsRef(cx).setBaseline(true)
JS::RuntimeOptionsRef(cx).setBaseline(true)
.setIon(true);
return cx;
}

Просмотреть файл

@ -145,7 +145,7 @@ END_TEST(testProfileStrings_isCalledWithInterpreter)
BEGIN_TEST(testProfileStrings_isCalledWithJIT)
{
CHECK(initialize(cx));
JS::ContextOptionsRef(cx).setBaseline(true)
JS::RuntimeOptionsRef(cx).setBaseline(true)
.setIon(true);
EXEC("function g() { var p = new Prof(); p.test_fn(); }");
@ -197,7 +197,7 @@ END_TEST(testProfileStrings_isCalledWithJIT)
BEGIN_TEST(testProfileStrings_isCalledWhenError)
{
CHECK(initialize(cx));
JS::ContextOptionsRef(cx).setBaseline(true)
JS::RuntimeOptionsRef(cx).setBaseline(true)
.setIon(true);
EXEC("function check2() { throw 'a'; }");
@ -222,7 +222,7 @@ END_TEST(testProfileStrings_isCalledWhenError)
BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
{
CHECK(initialize(cx));
JS::ContextOptionsRef(cx).setBaseline(true)
JS::RuntimeOptionsRef(cx).setBaseline(true)
.setIon(true);
EXEC("function b(p) { p.test_fn(); }");

Просмотреть файл

@ -881,6 +881,18 @@ JS_StringToVersion(const char *string)
return JSVERSION_UNKNOWN;
}
JS_PUBLIC_API(JS::RuntimeOptions &)
JS::RuntimeOptionsRef(JSRuntime *rt)
{
return rt->options();
}
JS_PUBLIC_API(JS::RuntimeOptions &)
JS::RuntimeOptionsRef(JSContext *cx)
{
return cx->runtime()->options();
}
JS_PUBLIC_API(JS::ContextOptions &)
JS::ContextOptionsRef(JSContext *cx)
{
@ -2452,36 +2464,6 @@ class AutoHoldZone
} /* anonymous namespace */
bool
JS::CompartmentOptions::baseline(JSContext *cx) const
{
return baselineOverride_.get(cx->options().baseline());
}
bool
JS::CompartmentOptions::typeInference(const ExclusiveContext *cx) const
{
/* Unlike the other options that can be overriden on a per compartment
* basis, the default value for the typeInference option is stored on the
* compartment's type zone, rather than the current JSContext. Type zones
* copy this default value over from the current JSContext when they are
* created.
*/
return typeInferenceOverride_.get(cx->compartment()->zone()->types.inferenceEnabled);
}
bool
JS::CompartmentOptions::ion(JSContext *cx) const
{
return ionOverride_.get(cx->options().ion());
}
bool
JS::CompartmentOptions::asmJS(JSContext *cx) const
{
return asmJSOverride_.get(cx->options().asmJS());
}
bool
JS::CompartmentOptions::cloneSingletons(JSContext *cx) const
{
@ -4462,7 +4444,7 @@ JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
strictOption = cx->options().strictMode();
extraWarningsOption = cx->options().extraWarnings();
werrorOption = cx->options().werror();
asmJSOption = cx->options().asmJS();
asmJSOption = cx->runtime()->options().asmJS();
}
bool
@ -5960,23 +5942,23 @@ JS_ScheduleGC(JSContext *cx, uint32_t count)
#endif
JS_PUBLIC_API(void)
JS_SetParallelParsingEnabled(JSContext *cx, bool enabled)
JS_SetParallelParsingEnabled(JSRuntime *rt, bool enabled)
{
#ifdef JS_ION
cx->runtime()->setParallelParsingEnabled(enabled);
rt->setParallelParsingEnabled(enabled);
#endif
}
JS_PUBLIC_API(void)
JS_SetParallelIonCompilationEnabled(JSContext *cx, bool enabled)
JS_SetParallelIonCompilationEnabled(JSRuntime *rt, bool enabled)
{
#ifdef JS_ION
cx->runtime()->setParallelIonCompilationEnabled(enabled);
rt->setParallelIonCompilationEnabled(enabled);
#endif
}
JS_PUBLIC_API(void)
JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t value)
JS_SetGlobalJitCompilerOption(JSRuntime *rt, JSJitCompilerOption opt, uint32_t value)
{
#ifdef JS_ION
@ -5999,19 +5981,19 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v
break;
case JSJITCOMPILER_ION_ENABLE:
if (value == 1) {
JS::ContextOptionsRef(cx).setIon(true);
JS::RuntimeOptionsRef(rt).setIon(true);
IonSpew(js::jit::IonSpew_Scripts, "Enable ion");
} else if (value == 0) {
JS::ContextOptionsRef(cx).setIon(false);
JS::RuntimeOptionsRef(rt).setIon(false);
IonSpew(js::jit::IonSpew_Scripts, "Disable ion");
}
break;
case JSJITCOMPILER_BASELINE_ENABLE:
if (value == 1) {
JS::ContextOptionsRef(cx).setBaseline(true);
JS::RuntimeOptionsRef(rt).setBaseline(true);
IonSpew(js::jit::IonSpew_BaselineScripts, "Enable baseline");
} else if (value == 0) {
JS::ContextOptionsRef(cx).setBaseline(false);
JS::RuntimeOptionsRef(rt).setBaseline(false);
IonSpew(js::jit::IonSpew_BaselineScripts, "Disable baseline");
}
break;
@ -6022,7 +6004,7 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v
}
JS_PUBLIC_API(int)
JS_GetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt)
JS_GetGlobalJitCompilerOption(JSRuntime *rt, JSJitCompilerOption opt)
{
#ifdef JS_ION
switch (opt) {
@ -6031,9 +6013,9 @@ JS_GetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt)
case JSJITCOMPILER_ION_USECOUNT_TRIGGER:
return jit::js_JitOptions.forcedDefaultIonUsesBeforeCompile;
case JSJITCOMPILER_ION_ENABLE:
return JS::ContextOptionsRef(cx).ion();
return JS::RuntimeOptionsRef(rt).ion();
case JSJITCOMPILER_BASELINE_ENABLE:
return JS::ContextOptionsRef(cx).baseline();
return JS::RuntimeOptionsRef(rt).baseline();
default:
break;
}

Просмотреть файл

@ -1439,6 +1439,69 @@ JS_StringToVersion(const char *string);
namespace JS {
class JS_PUBLIC_API(RuntimeOptions) {
public:
RuntimeOptions()
: baseline_(false),
typeInference_(false),
ion_(false),
asmJS_(false)
{
}
bool baseline() const { return baseline_; }
RuntimeOptions &setBaseline(bool flag) {
baseline_ = flag;
return *this;
}
RuntimeOptions &toggleBaseline() {
baseline_ = !baseline_;
return *this;
}
bool typeInference() const { return typeInference_; }
RuntimeOptions &setTypeInference(bool flag) {
typeInference_ = flag;
return *this;
}
RuntimeOptions &toggleTypeInference() {
typeInference_ = !typeInference_;
return *this;
}
bool ion() const { return ion_; }
RuntimeOptions &setIon(bool flag) {
ion_ = flag;
return *this;
}
RuntimeOptions &toggleIon() {
ion_ = !ion_;
return *this;
}
bool asmJS() const { return asmJS_; }
RuntimeOptions &setAsmJS(bool flag) {
asmJS_ = flag;
return *this;
}
RuntimeOptions &toggleAsmJS() {
asmJS_ = !asmJS_;
return *this;
}
private:
bool baseline_ : 1;
bool typeInference_ : 1;
bool ion_ : 1;
bool asmJS_ : 1;
};
JS_PUBLIC_API(RuntimeOptions &)
RuntimeOptionsRef(JSRuntime *rt);
JS_PUBLIC_API(RuntimeOptions &)
RuntimeOptionsRef(JSContext *cx);
class JS_PUBLIC_API(ContextOptions) {
public:
ContextOptions()
@ -1450,10 +1513,6 @@ class JS_PUBLIC_API(ContextOptions) {
noDefaultCompartmentObject_(false),
noScriptRval_(false),
strictMode_(false),
baseline_(false),
typeInference_(false),
ion_(false),
asmJS_(false),
cloneSingletons_(false)
{
}
@ -1538,46 +1597,6 @@ class JS_PUBLIC_API(ContextOptions) {
return *this;
}
bool baseline() const { return baseline_; }
ContextOptions &setBaseline(bool flag) {
baseline_ = flag;
return *this;
}
ContextOptions &toggleBaseline() {
baseline_ = !baseline_;
return *this;
}
bool typeInference() const { return typeInference_; }
ContextOptions &setTypeInference(bool flag) {
typeInference_ = flag;
return *this;
}
ContextOptions &toggleTypeInference() {
typeInference_ = !typeInference_;
return *this;
}
bool ion() const { return ion_; }
ContextOptions &setIon(bool flag) {
ion_ = flag;
return *this;
}
ContextOptions &toggleIon() {
ion_ = !ion_;
return *this;
}
bool asmJS() const { return asmJS_; }
ContextOptions &setAsmJS(bool flag) {
asmJS_ = flag;
return *this;
}
ContextOptions &toggleAsmJS() {
asmJS_ = !asmJS_;
return *this;
}
bool cloneSingletons() const { return cloneSingletons_; }
ContextOptions &setCloneSingletons(bool flag) {
cloneSingletons_ = flag;
@ -1597,10 +1616,6 @@ class JS_PUBLIC_API(ContextOptions) {
bool noDefaultCompartmentObject_ : 1;
bool noScriptRval_ : 1;
bool strictMode_ : 1;
bool baseline_ : 1;
bool typeInference_ : 1;
bool ion_ : 1;
bool asmJS_ : 1;
bool cloneSingletons_ : 1;
};
@ -2647,18 +2662,6 @@ class JS_PUBLIC_API(CompartmentOptions)
return *this;
}
bool baseline(JSContext *cx) const;
Override &baselineOverride() { return baselineOverride_; }
bool typeInference(const js::ExclusiveContext *cx) const;
Override &typeInferenceOverride() { return typeInferenceOverride_; }
bool ion(JSContext *cx) const;
Override &ionOverride() { return ionOverride_; }
bool asmJS(JSContext *cx) const;
Override &asmJSOverride() { return asmJSOverride_; }
bool cloneSingletons(JSContext *cx) const;
Override &cloneSingletonsOverride() { return cloneSingletonsOverride_; }
@ -2681,10 +2684,6 @@ class JS_PUBLIC_API(CompartmentOptions)
JSVersion version_;
bool invisibleToDebugger_;
bool mergeable_;
Override baselineOverride_;
Override typeInferenceOverride_;
Override ionOverride_;
Override asmJSOverride_;
Override cloneSingletonsOverride_;
union {
ZoneSpecifier spec;
@ -4664,10 +4663,10 @@ JS_ScheduleGC(JSContext *cx, uint32_t count);
#endif
extern JS_PUBLIC_API(void)
JS_SetParallelParsingEnabled(JSContext *cx, bool enabled);
JS_SetParallelParsingEnabled(JSRuntime *rt, bool enabled);
extern JS_PUBLIC_API(void)
JS_SetParallelIonCompilationEnabled(JSContext *cx, bool enabled);
JS_SetParallelIonCompilationEnabled(JSRuntime *rt, bool enabled);
#define JIT_COMPILER_OPTIONS(Register) \
Register(BASELINE_USECOUNT_TRIGGER, "baseline.usecount.trigger") \
@ -4686,9 +4685,9 @@ typedef enum JSJitCompilerOption {
} JSJitCompilerOption;
extern JS_PUBLIC_API(void)
JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t value);
JS_SetGlobalJitCompilerOption(JSRuntime *rt, JSJitCompilerOption opt, uint32_t value);
extern JS_PUBLIC_API(int)
JS_GetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt);
JS_GetGlobalJitCompilerOption(JSRuntime *rt, JSJitCompilerOption opt);
/*
* Convert a uint32_t index into a jsid.

Просмотреть файл

@ -521,7 +521,7 @@ namespace js {
inline bool
ExclusiveContext::typeInferenceEnabled() const
{
return compartment_->options().typeInference(this);
return zone()->types.inferenceEnabled;
}
inline js::Handle<js::GlobalObject*>

Просмотреть файл

@ -1862,7 +1862,7 @@ void
TypeZone::init(JSContext *cx)
{
if (!cx ||
!cx->options().typeInference() ||
!cx->runtime()->options().typeInference() ||
!cx->runtime()->jitSupportsFloatingPoint)
{
return;

Просмотреть файл

@ -282,7 +282,6 @@ enum ThingRootKind
THING_ROOT_SCRIPT,
THING_ROOT_LAZY_SCRIPT,
THING_ROOT_ID,
THING_ROOT_PROPERTY_ID,
THING_ROOT_VALUE,
THING_ROOT_TYPE,
THING_ROOT_BINDINGS,

Просмотреть файл

@ -41,14 +41,4 @@
*/
#define JS_OLD_GETTER_SETTER_METHODS 1
/* A kill-switch for bug 586842. Embedders shouldn't touch this! */
#define JS_USE_NEW_OBJECT_REPRESENTATION 0
#if JS_USE_NEW_OBJECT_REPRESENTATION
# define JS_NEW_OBJECT_REPRESENTATION_ONLY() ((void)0)
#else
# define JS_NEW_OBJECT_REPRESENTATION_ONLY() \
MOZ_ASSUME_UNREACHABLE("don't call this! to be used in the new object representation")
#endif
#endif /* jsversion_h */

Просмотреть файл

@ -118,11 +118,7 @@ static double gTimeoutInterval = -1.0;
static volatile bool gTimedOut = false;
static JS::Value gTimeoutFunc;
static bool enableTypeInference = true;
static bool enableDisassemblyDumps = false;
static bool enableIon = true;
static bool enableBaseline = true;
static bool enableAsmJS = true;
static bool printTiming = false;
static const char *jsCacheDir = nullptr;
@ -655,7 +651,8 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
JS::ContextOptions oldOptions = JS::ContextOptionsRef(cx);
JS::RuntimeOptions oldRuntimeOptions = JS::RuntimeOptionsRef(cx);
JS::ContextOptions oldContextOptions = JS::ContextOptionsRef(cx);
for (unsigned i = 0; i < args.length(); i++) {
JSString *str = JS::ToString(cx, args[i]);
if (!str)
@ -669,7 +666,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
if (strcmp(opt.ptr(), "strict") == 0)
JS::ContextOptionsRef(cx).toggleExtraWarnings();
else if (strcmp(opt.ptr(), "typeinfer") == 0)
JS::ContextOptionsRef(cx).toggleTypeInference();
JS::RuntimeOptionsRef(cx).toggleTypeInference();
else if (strcmp(opt.ptr(), "werror") == 0)
JS::ContextOptionsRef(cx).toggleWerror();
else if (strcmp(opt.ptr(), "strict_mode") == 0)
@ -693,19 +690,19 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
char *names = strdup("");
bool found = false;
if (!names && oldOptions.extraWarnings()) {
if (!names && oldContextOptions.extraWarnings()) {
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "strict");
found = true;
}
if (!names && oldOptions.typeInference()) {
if (!names && oldRuntimeOptions.typeInference()) {
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "typeinfer");
found = true;
}
if (!names && oldOptions.werror()) {
if (!names && oldContextOptions.werror()) {
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "werror");
found = true;
}
if (!names && oldOptions.strictMode()) {
if (!names && oldContextOptions.strictMode()) {
names = JS_sprintf_append(names, "%s%s", found ? "," : "", "strict_mode");
found = true;
}
@ -5510,14 +5507,6 @@ NewContext(JSRuntime *rt)
JS_SetContextPrivate(cx, data);
JS_SetErrorReporter(cx, my_ErrorReporter);
if (enableTypeInference)
JS::ContextOptionsRef(cx).toggleTypeInference();
if (enableIon)
JS::ContextOptionsRef(cx).toggleIon();
if (enableBaseline)
JS::ContextOptionsRef(cx).toggleBaseline();
if (enableAsmJS)
JS::ContextOptionsRef(cx).toggleAsmJS();
return cx;
}
@ -5619,11 +5608,11 @@ BindScriptArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
// so we're guarding the function definition with an #ifdef, too, to avoid
// build warning for unused function in non-ion-enabled builds:
#if defined(JS_ION)
static int
static bool
OptionFailure(const char *option, const char *str)
{
fprintf(stderr, "Unrecognized option for %s: %s\n", option, str);
return EXIT_FAILURE;
return false;
}
#endif /* JS_ION */
@ -5632,14 +5621,6 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
{
RootedObject obj(cx, obj_);
if (op->getBoolOption('c'))
compileOnly = true;
if (op->getBoolOption('w'))
reportWarnings = true;
else if (op->getBoolOption('W'))
reportWarnings = false;
if (op->getBoolOption('s'))
JS::ContextOptionsRef(cx).toggleExtraWarnings();
@ -5648,163 +5629,6 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
JS_SetDebugMode(cx, true);
}
jsCacheDir = op->getStringOption("js-cache");
if (jsCacheDir) {
if (op->getBoolOption("js-cache-per-process"))
jsCacheDir = JS_smprintf("%s/%u", jsCacheDir, (unsigned)getpid());
jsCacheAsmJSPath = JS_smprintf("%s/asmjs.cache", jsCacheDir);
}
if (op->getBoolOption('b'))
printTiming = true;
if (op->getBoolOption('D')) {
cx->runtime()->profilingScripts = true;
enableDisassemblyDumps = true;
}
#ifdef JS_THREADSAFE
int32_t threadCount = op->getIntOption("thread-count");
if (threadCount >= 0)
SetFakeCPUCount(threadCount);
#endif /* JS_THREADSAFE */
#if defined(JS_ION)
if (op->getBoolOption("no-ion")) {
enableIon = false;
JS::ContextOptionsRef(cx).toggleIon();
}
if (op->getBoolOption("no-asmjs")) {
enableAsmJS = false;
JS::ContextOptionsRef(cx).toggleAsmJS();
}
if (op->getBoolOption("no-baseline")) {
enableBaseline = false;
JS::ContextOptionsRef(cx).toggleBaseline();
}
if (const char *str = op->getStringOption("ion-gvn")) {
if (strcmp(str, "off") == 0) {
jit::js_JitOptions.disableGvn = true;
} else if (strcmp(str, "pessimistic") == 0) {
jit::js_JitOptions.forceGvnKind = true;
jit::js_JitOptions.forcedGvnKind = jit::GVN_Pessimistic;
} else if (strcmp(str, "optimistic") == 0) {
jit::js_JitOptions.forceGvnKind = true;
jit::js_JitOptions.forcedGvnKind = jit::GVN_Optimistic;
} else {
return OptionFailure("ion-gvn", str);
}
}
if (const char *str = op->getStringOption("ion-licm")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableLicm = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableLicm = true;
else
return OptionFailure("ion-licm", str);
}
if (const char *str = op->getStringOption("ion-edgecase-analysis")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableEdgeCaseAnalysis = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableEdgeCaseAnalysis = true;
else
return OptionFailure("ion-edgecase-analysis", str);
}
if (const char *str = op->getStringOption("ion-range-analysis")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableRangeAnalysis = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableRangeAnalysis = true;
else
return OptionFailure("ion-range-analysis", str);
}
if (op->getBoolOption("ion-check-range-analysis"))
jit::js_JitOptions.checkRangeAnalysis = true;
if (const char *str = op->getStringOption("ion-inlining")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableInlining = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableInlining = true;
else
return OptionFailure("ion-inlining", str);
}
if (const char *str = op->getStringOption("ion-osr")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.osr = true;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.osr = false;
else
return OptionFailure("ion-osr", str);
}
if (const char *str = op->getStringOption("ion-limit-script-size")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.limitScriptSize = true;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.limitScriptSize = false;
else
return OptionFailure("ion-limit-script-size", str);
}
int32_t useCount = op->getIntOption("ion-uses-before-compile");
if (useCount >= 0)
jit::js_JitOptions.setUsesBeforeCompile(useCount);
useCount = op->getIntOption("baseline-uses-before-compile");
if (useCount >= 0)
jit::js_JitOptions.baselineUsesBeforeCompile = useCount;
if (op->getBoolOption("baseline-eager"))
jit::js_JitOptions.baselineUsesBeforeCompile = 0;
if (const char *str = op->getStringOption("ion-regalloc")) {
if (strcmp(str, "lsra") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_LSRA;
} else if (strcmp(str, "backtracking") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_Backtracking;
} else if (strcmp(str, "stupid") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_Stupid;
} else {
return OptionFailure("ion-regalloc", str);
}
}
if (op->getBoolOption("ion-eager"))
jit::js_JitOptions.setEagerCompilation();
if (op->getBoolOption("ion-compile-try-catch"))
jit::js_JitOptions.compileTryCatch = true;
bool parallelCompilation = true;
if (const char *str = op->getStringOption("ion-parallel-compile")) {
if (strcmp(str, "off") == 0)
parallelCompilation = false;
else if (strcmp(str, "on") != 0)
return OptionFailure("ion-parallel-compile", str);
}
#ifdef JS_THREADSAFE
cx->runtime()->setParallelIonCompilationEnabled(parallelCompilation);
#endif
#endif /* JS_ION */
#ifdef DEBUG
if (op->getBoolOption("dump-entrained-variables"))
dumpEntrainedVariables = true;
#endif
/* |scriptArgs| gets bound on the global before any code is run. */
if (!BindScriptArgs(cx, obj, op))
return EXIT_FAILURE;
@ -5848,20 +5672,175 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
return gExitCode ? gExitCode : EXIT_SUCCESS;
}
static bool
SetRuntimeOptions(JSRuntime *rt, const OptionParser &op)
{
#if defined(JS_ION)
bool enableBaseline = !op.getBoolOption("no-baseline");
bool enableIon = !op.getBoolOption("no-ion");
bool enableTypeInference = !op.getBoolOption("no-ti");
bool enableAsmJS = !op.getBoolOption("no-asmjs");
JS::RuntimeOptionsRef(rt).setBaseline(enableBaseline)
.setIon(enableIon)
.setTypeInference(enableTypeInference)
.setAsmJS(enableAsmJS);
if (const char *str = op.getStringOption("ion-gvn")) {
if (strcmp(str, "off") == 0) {
jit::js_JitOptions.disableGvn = true;
} else if (strcmp(str, "pessimistic") == 0) {
jit::js_JitOptions.forceGvnKind = true;
jit::js_JitOptions.forcedGvnKind = jit::GVN_Pessimistic;
} else if (strcmp(str, "optimistic") == 0) {
jit::js_JitOptions.forceGvnKind = true;
jit::js_JitOptions.forcedGvnKind = jit::GVN_Optimistic;
} else {
return OptionFailure("ion-gvn", str);
}
}
if (const char *str = op.getStringOption("ion-licm")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableLicm = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableLicm = true;
else
return OptionFailure("ion-licm", str);
}
if (const char *str = op.getStringOption("ion-edgecase-analysis")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableEdgeCaseAnalysis = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableEdgeCaseAnalysis = true;
else
return OptionFailure("ion-edgecase-analysis", str);
}
if (const char *str = op.getStringOption("ion-range-analysis")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableRangeAnalysis = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableRangeAnalysis = true;
else
return OptionFailure("ion-range-analysis", str);
}
if (op.getBoolOption("ion-check-range-analysis"))
jit::js_JitOptions.checkRangeAnalysis = true;
if (const char *str = op.getStringOption("ion-inlining")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.disableInlining = false;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.disableInlining = true;
else
return OptionFailure("ion-inlining", str);
}
if (const char *str = op.getStringOption("ion-osr")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.osr = true;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.osr = false;
else
return OptionFailure("ion-osr", str);
}
if (const char *str = op.getStringOption("ion-limit-script-size")) {
if (strcmp(str, "on") == 0)
jit::js_JitOptions.limitScriptSize = true;
else if (strcmp(str, "off") == 0)
jit::js_JitOptions.limitScriptSize = false;
else
return OptionFailure("ion-limit-script-size", str);
}
int32_t useCount = op.getIntOption("ion-uses-before-compile");
if (useCount >= 0)
jit::js_JitOptions.setUsesBeforeCompile(useCount);
useCount = op.getIntOption("baseline-uses-before-compile");
if (useCount >= 0)
jit::js_JitOptions.baselineUsesBeforeCompile = useCount;
if (op.getBoolOption("baseline-eager"))
jit::js_JitOptions.baselineUsesBeforeCompile = 0;
if (const char *str = op.getStringOption("ion-regalloc")) {
if (strcmp(str, "lsra") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_LSRA;
} else if (strcmp(str, "backtracking") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_Backtracking;
} else if (strcmp(str, "stupid") == 0) {
jit::js_JitOptions.forceRegisterAllocator = true;
jit::js_JitOptions.forcedRegisterAllocator = jit::RegisterAllocator_Stupid;
} else {
return OptionFailure("ion-regalloc", str);
}
}
if (op.getBoolOption("ion-eager"))
jit::js_JitOptions.setEagerCompilation();
if (op.getBoolOption("ion-compile-try-catch"))
jit::js_JitOptions.compileTryCatch = true;
bool parallelCompilation = true;
if (const char *str = op.getStringOption("ion-parallel-compile")) {
if (strcmp(str, "off") == 0)
parallelCompilation = false;
else if (strcmp(str, "on") != 0)
return OptionFailure("ion-parallel-compile", str);
}
#ifdef JS_THREADSAFE
rt->setParallelIonCompilationEnabled(parallelCompilation);
#endif
#endif // JS_ION
#ifdef JS_ARM_SIMULATOR
if (op.getBoolOption("arm-sim-icache-checks"))
jit::Simulator::ICacheCheckingEnabled = true;
int32_t stopAt = op.getIntOption("arm-sim-stop-at");
if (stopAt >= 0)
jit::Simulator::StopSimAt = stopAt;
#endif
reportWarnings = op.getBoolOption('w');
compileOnly = op.getBoolOption('c');
printTiming = op.getBoolOption('b');
rt->profilingScripts = enableDisassemblyDumps = op.getBoolOption('D');
jsCacheDir = op.getStringOption("js-cache");
if (jsCacheDir) {
if (op.getBoolOption("js-cache-per-process"))
jsCacheDir = JS_smprintf("%s/%u", jsCacheDir, (unsigned)getpid());
jsCacheAsmJSPath = JS_smprintf("%s/asmjs.cache", jsCacheDir);
}
#ifdef JS_THREADSAFE
int32_t threadCount = op.getIntOption("thread-count");
if (threadCount >= 0)
SetFakeCPUCount(threadCount);
#endif /* JS_THREADSAFE */
#ifdef DEBUG
dumpEntrainedVariables = op.getBoolOption("dump-entrained-variables");
#endif
return true;
}
static int
Shell(JSContext *cx, OptionParser *op, char **envp)
{
JSAutoRequest ar(cx);
/*
* First check to see if type inference is enabled. These flags
* must be set on the compartment when it is constructed.
*/
if (op->getBoolOption("no-ti")) {
enableTypeInference = false;
JS::ContextOptionsRef(cx).toggleTypeInference();
}
if (op->getBoolOption("fuzzing-safe"))
fuzzingSafe = true;
else
@ -6077,8 +6056,7 @@ main(int argc, char **argv, char **envp)
* Process OOM options as early as possible so that we can observe as many
* allocations as possible.
*/
if (op.getBoolOption('O'))
OOM_printAllocationCount = true;
OOM_printAllocationCount = op.getBoolOption('O');
#if defined(JS_CODEGEN_X86) && defined(JS_ION)
if (op.getBoolOption("no-fpu"))
@ -6095,16 +6073,8 @@ main(int argc, char **argv, char **envp)
PropagateFlagToNestedShells("--no-sse4");
}
#endif
#endif
#ifdef JS_ARM_SIMULATOR
if (op.getBoolOption("arm-sim-icache-checks"))
jit::Simulator::ICacheCheckingEnabled = true;
int32_t stopAt = op.getIntOption("arm-sim-stop-at");
if (stopAt >= 0)
jit::Simulator::StopSimAt = stopAt;
#endif
#endif // DEBUG
// Start the engine.
if (!JS_Init())
@ -6114,6 +6084,10 @@ main(int argc, char **argv, char **envp)
rt = JS_NewRuntime(32L * 1024L * 1024L, JS_USE_HELPER_THREADS);
if (!rt)
return 1;
if (!SetRuntimeOptions(rt, op))
return 1;
gTimeoutFunc = NullValue();
if (!JS_AddNamedValueRootRT(rt, &gTimeoutFunc, "gTimeoutFunc"))
return 1;

Просмотреть файл

@ -44,11 +44,6 @@
#include "vm/Shape-inl.h"
#if JS_USE_NEW_OBJECT_REPRESENTATION
// See the comment above OldObjectRepresentationHack.
# error "TypedArray support for new object representation unimplemented."
#endif
using namespace js;
using namespace js::gc;
using namespace js::types;

Просмотреть файл

@ -320,6 +320,92 @@ ArrayBufferViewObject::setNextView(ArrayBufferViewObject *view)
PostBarrierTypedArrayObject(this);
}
extern uint32_t JS_FASTCALL
ClampDoubleToUint8(const double x);
struct uint8_clamped {
uint8_t val;
uint8_clamped() { }
uint8_clamped(const uint8_clamped& other) : val(other.val) { }
// invoke our assignment helpers for constructor conversion
uint8_clamped(uint8_t x) { *this = x; }
uint8_clamped(uint16_t x) { *this = x; }
uint8_clamped(uint32_t x) { *this = x; }
uint8_clamped(int8_t x) { *this = x; }
uint8_clamped(int16_t x) { *this = x; }
uint8_clamped(int32_t x) { *this = x; }
uint8_clamped(double x) { *this = x; }
uint8_clamped& operator=(const uint8_clamped& x) {
val = x.val;
return *this;
}
uint8_clamped& operator=(uint8_t x) {
val = x;
return *this;
}
uint8_clamped& operator=(uint16_t x) {
val = (x > 255) ? 255 : uint8_t(x);
return *this;
}
uint8_clamped& operator=(uint32_t x) {
val = (x > 255) ? 255 : uint8_t(x);
return *this;
}
uint8_clamped& operator=(int8_t x) {
val = (x >= 0) ? uint8_t(x) : 0;
return *this;
}
uint8_clamped& operator=(int16_t x) {
val = (x >= 0)
? ((x < 255)
? uint8_t(x)
: 255)
: 0;
return *this;
}
uint8_clamped& operator=(int32_t x) {
val = (x >= 0)
? ((x < 255)
? uint8_t(x)
: 255)
: 0;
return *this;
}
uint8_clamped& operator=(const double x) {
val = uint8_t(ClampDoubleToUint8(x));
return *this;
}
operator uint8_t() const {
return val;
}
void staticAsserts() {
static_assert(sizeof(uint8_clamped) == 1,
"uint8_clamped must be layout-compatible with uint8_t");
}
};
/* Note that we can't use std::numeric_limits here due to uint8_clamped. */
template<typename T> inline const bool TypeIsFloatingPoint() { return false; }
template<> inline const bool TypeIsFloatingPoint<float>() { return true; }
template<> inline const bool TypeIsFloatingPoint<double>() { return true; }
template<typename T> inline const bool TypeIsUnsigned() { return false; }
template<> inline const bool TypeIsUnsigned<uint8_t>() { return true; }
template<> inline const bool TypeIsUnsigned<uint16_t>() { return true; }
template<> inline const bool TypeIsUnsigned<uint32_t>() { return true; }
} // namespace js
#endif // vm_ArrayBufferObject_h

Просмотреть файл

@ -15,6 +15,7 @@
#include "builtin/RegExp.h"
#include "js/Vector.h"
#include "vm/ArrayBufferObject.h"
#include "vm/ErrorObject.h"
extern JSObject *

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше