зеркало из https://github.com/mozilla/gecko-dev.git
Backout bug 743615 because of build bustage; a=backout
This commit is contained in:
Родитель
03fb5bb573
Коммит
49140e6b27
|
@ -44,15 +44,9 @@ namespace dom {
|
|||
|
||||
enum StructuredCloneTags {
|
||||
SCTAG_BASE = JS_SCTAG_USER_MIN,
|
||||
|
||||
// These tags are used only for main thread structured clone.
|
||||
SCTAG_DOM_BLOB,
|
||||
SCTAG_DOM_FILE,
|
||||
SCTAG_DOM_FILELIST,
|
||||
|
||||
// These tags are used for both main thread and workers.
|
||||
SCTAG_DOM_IMAGEDATA,
|
||||
|
||||
SCTAG_DOM_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -86,8 +86,6 @@
|
|||
#include "WrapperFactory.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "StructuredCloneTags.h"
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
|
||||
#include "nsJSPrincipals.h"
|
||||
|
||||
|
@ -115,7 +113,6 @@
|
|||
#include "sampler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
const size_t gStackSize = 8192;
|
||||
|
||||
|
@ -3613,36 +3610,7 @@ NS_DOMReadStructuredClone(JSContext* cx,
|
|||
uint32_t data,
|
||||
void* closure)
|
||||
{
|
||||
if (tag == SCTAG_DOM_IMAGEDATA) {
|
||||
// Read the information out of the stream.
|
||||
uint32_t width, height;
|
||||
JS::Value dataArray;
|
||||
if (!JS_ReadUint32Pair(reader, &width, &height) ||
|
||||
!JS_ReadTypedArray(reader, &dataArray)) {
|
||||
return nsnull;
|
||||
}
|
||||
MOZ_ASSERT(dataArray.isObject());
|
||||
|
||||
// Construct the ImageData.
|
||||
nsCOMPtr<nsIDOMImageData> imageData = new ImageData(width, height,
|
||||
dataArray.toObject());
|
||||
// Wrap it in a jsval.
|
||||
JSObject* global = JS_GetGlobalForScopeChain(cx);
|
||||
if (!global) {
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
|
||||
JS::Value val;
|
||||
nsresult rv =
|
||||
nsContentUtils::WrapNative(cx, global, imageData, &val,
|
||||
getter_AddRefs(wrapper));
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
return val.toObjectOrNull();
|
||||
}
|
||||
|
||||
// Don't know what this is. Bail.
|
||||
// We don't currently support any extensions to structured cloning.
|
||||
nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -3653,30 +3621,7 @@ NS_DOMWriteStructuredClone(JSContext* cx,
|
|||
JSObject* obj,
|
||||
void *closure)
|
||||
{
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrappedNative;
|
||||
nsContentUtils::XPConnect()->
|
||||
GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wrappedNative));
|
||||
nsISupports *native = wrappedNative ? wrappedNative->Native() : nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMImageData> imageData = do_QueryInterface(native);
|
||||
if (imageData) {
|
||||
// Prepare the ImageData internals.
|
||||
PRUint32 width, height;
|
||||
JS::Value dataArray;
|
||||
if (NS_FAILED(imageData->GetWidth(&width)) ||
|
||||
NS_FAILED(imageData->GetHeight(&height)) ||
|
||||
NS_FAILED(imageData->GetData(cx, &dataArray)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write the internals to the stream.
|
||||
return JS_WriteUint32Pair(writer, SCTAG_DOM_IMAGEDATA, 0) &&
|
||||
JS_WriteUint32Pair(writer, width, height) &&
|
||||
JS_WriteTypedArray(writer, dataArray);
|
||||
}
|
||||
|
||||
// Don't know what this is. Bail.
|
||||
// We don't currently support any extensions to structured cloning.
|
||||
nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
|
|
@ -157,9 +157,6 @@ _TEST_FILES = \
|
|||
test_bug735237.html \
|
||||
test_bug739038.html \
|
||||
test_bug740811.html \
|
||||
test_bug743615.html \
|
||||
utils_bug743615.js \
|
||||
worker_bug743615.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=743615
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 743615</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="utils_bug743615.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=743615">Mozilla Bug 743615</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<canvas id="c" width="200" height="200"><canvas>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for structured cloning ImageData. **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.addEventListener('message', windowMessage);
|
||||
startTest();
|
||||
|
||||
function startTest() {
|
||||
// Make an ImageData.
|
||||
var ctx = document.getElementById('c').getContext('2d');
|
||||
ctx.fillStyle = 'rgb(';
|
||||
ctx.fillRect(30, 30, 50, 50);
|
||||
|
||||
// Make a blank ImageData.
|
||||
var imageData = ctx.createImageData(200, 200);
|
||||
is(imageData.data.length, imageData.width * imageData.height * 4,
|
||||
'right size for data');
|
||||
|
||||
// Write some things into it.
|
||||
var pattern = makePattern(imageData.data.length, 42, 7);
|
||||
setPattern(imageData, pattern);
|
||||
ok(checkPattern(imageData, pattern), 'Can read it back before sending');
|
||||
|
||||
// PostMessage it to ourselves.
|
||||
window.postMessage({ imageData: imageData,
|
||||
pattern: pattern,
|
||||
dataRef: imageData.data }, '*');
|
||||
}
|
||||
|
||||
function windowMessage(evt) {
|
||||
// Check the pattern we received.
|
||||
var imageData = evt.data.imageData;
|
||||
var pattern = evt.data.pattern;
|
||||
ok(checkPattern(imageData, pattern),
|
||||
'postMessage from self worked correctly');
|
||||
|
||||
// We're not spec compliant on this yet.
|
||||
todo_is(imageData.data, evt.data.dataRef,
|
||||
'Should have backrefs for imagedata buffer');
|
||||
|
||||
// Make a new pattern, and send it to a worker.
|
||||
pattern = makePattern(imageData.data.length, 4, 3);
|
||||
setPattern(imageData, pattern);
|
||||
var worker = new Worker('worker_bug743615.js');
|
||||
worker.onmessage = workerMessage;
|
||||
worker.postMessage( {imageData: imageData, pattern: pattern });
|
||||
}
|
||||
|
||||
function workerMessage(evt) {
|
||||
// Relay the results of the worker-side tests.
|
||||
is(evt.data.statusMessage, 'PASS', evt.data.statusMessage);
|
||||
|
||||
// Test what the worker sent us.
|
||||
ok(checkPattern(evt.data.imageData, evt.data.pattern),
|
||||
'postMessage from worker worked correctly');
|
||||
|
||||
// All done.
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||
function makePattern(len, start, inc) {
|
||||
var pattern = [];
|
||||
while(len) {
|
||||
pattern.push(start);
|
||||
start = (start + inc) % 256;
|
||||
--len;
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
|
||||
function setPattern(imageData, pattern) {
|
||||
if (pattern.length != imageData.data.length)
|
||||
throw Error('Invalid pattern');
|
||||
for (var i = 0; i < pattern.length; ++i)
|
||||
imageData.data[i] = pattern[i];
|
||||
}
|
||||
|
||||
function checkPattern(imageData, pattern) {
|
||||
if (pattern.length != imageData.data.length)
|
||||
throw Error('Invalid pattern');
|
||||
for (var i = 0; i < pattern.length; ++i)
|
||||
if (imageData.data[i] != pattern[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
importScripts('utils_bug743615.js');
|
||||
|
||||
self.onmessage = function onMessage(evt) {
|
||||
// Check the pattern that was sent.
|
||||
var imageData = evt.data.imageData;
|
||||
var pattern = evt.data.pattern;
|
||||
var statusMessage = checkPattern(imageData, pattern)
|
||||
? 'PASS' : 'Got corrupt typed array in worker';
|
||||
|
||||
// Check against the interface object.
|
||||
if (!(imageData instanceof ImageData))
|
||||
statusMessage += ", Bad interface object in worker";
|
||||
|
||||
// Check the getters.
|
||||
if (imageData.width * imageData.height != imageData.data.length / 4) {
|
||||
statusMessage += ", Bad ImageData getters in worker: "
|
||||
statusMessage += [imageData.width, imageData.height].join(', ');
|
||||
}
|
||||
|
||||
// Make sure that writing to .data is a no-op when not in strict mode.
|
||||
var origData = imageData.data;
|
||||
var threw = false;
|
||||
try {
|
||||
imageData.data = [];
|
||||
imageData.width = 2;
|
||||
imageData.height = 2;
|
||||
} catch(e) { threw = true; }
|
||||
if (threw || imageData.data !== origData)
|
||||
statusMessage = statusMessage + ", Should silently ignore sets";
|
||||
|
||||
|
||||
|
||||
// Send back a new pattern.
|
||||
pattern = makePattern(imageData.data.length, 99, 2);
|
||||
setPattern(imageData, pattern);
|
||||
self.postMessage({ statusMessage: statusMessage, imageData: imageData,
|
||||
pattern: pattern });
|
||||
}
|
|
@ -1,203 +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 "ImageData.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "jstypedarray.h"
|
||||
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
class ImageData
|
||||
{
|
||||
static JSClass sClass;
|
||||
static JSPropertySpec sProperties[];
|
||||
|
||||
enum SLOT {
|
||||
SLOT_width = 0,
|
||||
SLOT_height,
|
||||
SLOT_data,
|
||||
|
||||
SLOT_COUNT
|
||||
};
|
||||
|
||||
public:
|
||||
static JSObject*
|
||||
InitClass(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
return JS_InitClass(aCx, aObj, NULL, &sClass, Construct, 0, sProperties,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
Create(JSContext* aCx, uint32_t aWidth, uint32_t aHeight, JSObject *aData)
|
||||
{
|
||||
MOZ_ASSERT(aData);
|
||||
MOZ_ASSERT(js_IsTypedArray(aData));
|
||||
MOZ_ASSERT(JS_GetTypedArrayType(aData) == js::TypedArray::TYPE_UINT8_CLAMPED);
|
||||
|
||||
JSObject* obj = JS_NewObject(aCx, &sClass, NULL, NULL);
|
||||
if (!obj) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JS_SetReservedSlot(obj, SLOT_width, UINT_TO_JSVAL(aWidth));
|
||||
JS_SetReservedSlot(obj, SLOT_height, UINT_TO_JSVAL(aHeight));
|
||||
JS_SetReservedSlot(obj, SLOT_data, OBJECT_TO_JSVAL(aData));
|
||||
|
||||
// This is an empty object. The point is just to differentiate instances
|
||||
// from the interface object.
|
||||
ImageData* priv = new ImageData();
|
||||
JS_SetPrivate(obj, priv);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsInstance(JSObject* aObj)
|
||||
{
|
||||
return JS_GetClass(aObj) == &sClass;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
GetWidth(JSObject* aObj)
|
||||
{
|
||||
MOZ_ASSERT(IsInstance(aObj));
|
||||
return JS_DoubleToUint32(JS_GetReservedSlot(aObj, SLOT_width).toNumber());
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
GetHeight(JSObject* aObj)
|
||||
{
|
||||
MOZ_ASSERT(IsInstance(aObj));
|
||||
return JS_DoubleToUint32(JS_GetReservedSlot(aObj, SLOT_height).toNumber());
|
||||
}
|
||||
|
||||
static
|
||||
JSObject* GetData(JSObject* aObj)
|
||||
{
|
||||
MOZ_ASSERT(IsInstance(aObj));
|
||||
return &JS_GetReservedSlot(aObj, SLOT_data).toObject();
|
||||
}
|
||||
|
||||
private:
|
||||
ImageData()
|
||||
{
|
||||
MOZ_COUNT_CTOR(mozilla::dom::workers::ImageData);
|
||||
}
|
||||
|
||||
~ImageData()
|
||||
{
|
||||
MOZ_COUNT_DTOR(mozilla::dom::workers::ImageData);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
Construct(JSContext* aCx, unsigned aArgc, jsval* aVp)
|
||||
{
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR,
|
||||
sClass.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
Finalize(JSFreeOp* aFop, JSObject* aObj)
|
||||
{
|
||||
MOZ_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete static_cast<ImageData*>(JS_GetPrivate(aObj));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, "GetProperty",
|
||||
classPtr->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(JSID_IS_INT(aIdval));
|
||||
MOZ_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < SLOT_COUNT);
|
||||
|
||||
*aVp = JS_GetReservedSlot(aObj, JSID_TO_INT(aIdval));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
JSClass ImageData::sClass = {
|
||||
"ImageData",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize
|
||||
};
|
||||
|
||||
JSPropertySpec ImageData::sProperties[] = {
|
||||
// These properties are read-only per spec, which means that sets must throw
|
||||
// in strict mode and silently fail otherwise. This is a problem for workers
|
||||
// in general (because js_GetterOnlyPropertyStub throws unconditionally). The
|
||||
// general plan for fixing this involves the new DOM bindings. But Peace
|
||||
// Keeper breaks if we throw when setting these properties, so we need to do
|
||||
// something about it in the mean time. So we use NULL, which defaults to the
|
||||
// class setter (JS_StrictPropertyStub), which is always a silent no-op,
|
||||
// regardless of strict mode. Not ideal, but good enough for now.
|
||||
{ "width", SLOT_width, PROPERTY_FLAGS, GetProperty, NULL },
|
||||
{ "height", SLOT_height, PROPERTY_FLAGS, GetProperty, NULL },
|
||||
{ "data", SLOT_data, PROPERTY_FLAGS, GetProperty, NULL },
|
||||
{ 0, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
namespace imagedata {
|
||||
|
||||
bool
|
||||
InitClass(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
return !!ImageData::InitClass(aCx, aGlobal);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
Create(JSContext* aCx, uint32_t aWidth, uint32_t aHeight, JSObject* aData)
|
||||
{
|
||||
return ImageData::Create(aCx, aWidth, aHeight, aData);
|
||||
}
|
||||
|
||||
bool
|
||||
IsImageData(JSObject* aObj)
|
||||
{
|
||||
return ImageData::IsInstance(aObj);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetWidth(JSObject* aObj)
|
||||
{
|
||||
return ImageData::GetWidth(aObj);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetHeight(JSObject* aObj)
|
||||
{
|
||||
return ImageData::GetHeight(aObj);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
GetData(JSObject* aObj)
|
||||
{
|
||||
return ImageData::GetData(aObj);
|
||||
}
|
||||
|
||||
|
||||
} // namespace imagedata
|
||||
|
||||
END_WORKERS_NAMESPACE
|
|
@ -1,41 +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/. */
|
||||
|
||||
#ifndef mozilla_dom_workers_imagedata_h__
|
||||
#define mozilla_dom_workers_imagedata_h__
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
namespace imagedata {
|
||||
|
||||
bool
|
||||
InitClass(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
JSObject*
|
||||
Create(JSContext* aCx, uint32_t aWidth, uint32_t aHeight, JSObject* aData);
|
||||
|
||||
/*
|
||||
* All data members live in private slots on the JS Object. Callers must
|
||||
* first check IsImageData, after which they may call the data accessors.
|
||||
*/
|
||||
|
||||
bool
|
||||
IsImageData(JSObject* aObj);
|
||||
|
||||
uint32_t
|
||||
GetWidth(JSObject* aObj);
|
||||
|
||||
uint32_t
|
||||
GetHeight(JSObject* aObj);
|
||||
|
||||
JSObject*
|
||||
GetData(JSObject* aObj);
|
||||
|
||||
} // namespace imagedata
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_workers_imagedata_h__
|
|
@ -24,7 +24,6 @@ CPPSRCS = \
|
|||
File.cpp \
|
||||
FileReaderSync.cpp \
|
||||
FileReaderSyncPrivate.cpp \
|
||||
ImageData.cpp \
|
||||
Location.cpp \
|
||||
Navigator.cpp \
|
||||
Principal.cpp \
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include "Events.h"
|
||||
#include "Exceptions.h"
|
||||
#include "File.h"
|
||||
#include "ImageData.h"
|
||||
#include "Principal.h"
|
||||
#include "RuntimeService.h"
|
||||
#include "ScriptLoader.h"
|
||||
|
@ -104,7 +103,6 @@ using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
|
|||
|
||||
USING_WORKERS_NAMESPACE
|
||||
using namespace mozilla::dom::workers::events;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -335,25 +333,6 @@ struct WorkerStructuredCloneCallbacks
|
|||
return jsBlob;
|
||||
}
|
||||
}
|
||||
// See if the object is an ImageData.
|
||||
else if (aTag == SCTAG_DOM_IMAGEDATA) {
|
||||
JS_ASSERT(!aData);
|
||||
|
||||
// Read the information out of the stream.
|
||||
uint32_t width, height;
|
||||
jsval dataArray;
|
||||
if (!JS_ReadUint32Pair(aReader, &width, &height) ||
|
||||
!JS_ReadTypedArray(aReader, &dataArray))
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
MOZ_ASSERT(dataArray.isObject());
|
||||
|
||||
// Construct the ImageData.
|
||||
JSObject* obj = imagedata::Create(aCx, width, height,
|
||||
JSVAL_TO_OBJECT(dataArray));
|
||||
return obj;
|
||||
}
|
||||
|
||||
Error(aCx, 0);
|
||||
return nsnull;
|
||||
|
@ -395,19 +374,6 @@ struct WorkerStructuredCloneCallbacks
|
|||
}
|
||||
}
|
||||
|
||||
// See if this is an ImageData object.
|
||||
if (imagedata::IsImageData(aObj)) {
|
||||
// Pull the properties off the object.
|
||||
uint32_t width = imagedata::GetWidth(aObj);
|
||||
uint32_t height = imagedata::GetHeight(aObj);
|
||||
JSObject* data = imagedata::GetData(aObj);
|
||||
|
||||
// Write the structured clone.
|
||||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_IMAGEDATA, 0) &&
|
||||
JS_WriteUint32Pair(aWriter, width, height) &&
|
||||
JS_WriteTypedArray(aWriter, OBJECT_TO_JSVAL(data));
|
||||
}
|
||||
|
||||
Error(aCx, 0);
|
||||
return false;
|
||||
}
|
||||
|
@ -500,6 +466,12 @@ struct MainThreadWorkerStructuredCloneCallbacks
|
|||
}
|
||||
}
|
||||
|
||||
JSObject* clone =
|
||||
WorkerStructuredCloneCallbacks::Read(aCx, aReader, aTag, aData, aClosure);
|
||||
if (clone) {
|
||||
return clone;
|
||||
}
|
||||
|
||||
JS_ClearPendingException(aCx);
|
||||
return NS_DOMReadStructuredClone(aCx, aReader, aTag, aData, nsnull);
|
||||
}
|
||||
|
@ -555,6 +527,12 @@ struct MainThreadWorkerStructuredCloneCallbacks
|
|||
}
|
||||
}
|
||||
|
||||
JSBool ok =
|
||||
WorkerStructuredCloneCallbacks::Write(aCx, aWriter, aObj, aClosure);
|
||||
if (ok) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
JS_ClearPendingException(aCx);
|
||||
return NS_DOMWriteStructuredClone(aCx, aWriter, aObj, nsnull);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "nsStringGlue.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTPriorityQueue.h"
|
||||
#include "StructuredCloneTags.h"
|
||||
|
||||
#include "EventTarget.h"
|
||||
#include "Queue.h"
|
||||
|
@ -813,7 +812,7 @@ GetWorkerPrivateFromContext(JSContext* aCx);
|
|||
|
||||
enum WorkerStructuredDataType
|
||||
{
|
||||
DOMWORKER_SCTAG_FILE = SCTAG_DOM_MAX,
|
||||
DOMWORKER_SCTAG_FILE = JS_SCTAG_USER_MIN + 0x1000,
|
||||
DOMWORKER_SCTAG_BLOB,
|
||||
|
||||
DOMWORKER_SCTAG_END
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "File.h"
|
||||
#include "FileReaderSync.h"
|
||||
#include "Location.h"
|
||||
#include "ImageData.h"
|
||||
#include "Navigator.h"
|
||||
#include "Principal.h"
|
||||
#include "ScriptLoader.h"
|
||||
|
@ -997,7 +996,6 @@ CreateDedicatedWorkerGlobalScope(JSContext* aCx)
|
|||
!filereadersync::InitClass(aCx, global) ||
|
||||
!exceptions::InitClasses(aCx, global) ||
|
||||
!location::InitClass(aCx, global) ||
|
||||
!imagedata::InitClass(aCx, global) ||
|
||||
!navigator::InitClass(aCx, global)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -5183,18 +5183,12 @@ JS_ReadUint32Pair(JSStructuredCloneReader *r, uint32_t *p1, uint32_t *p2);
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_ReadBytes(JSStructuredCloneReader *r, void *p, size_t len);
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ReadTypedArray(JSStructuredCloneReader *r, jsval *vp);
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_WriteUint32Pair(JSStructuredCloneWriter *w, uint32_t tag, uint32_t data);
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len);
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_WriteTypedArray(JSStructuredCloneWriter *w, jsval v);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
|
|
|
@ -424,13 +424,6 @@ JSStructuredCloneWriter::checkStack()
|
|||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_WriteTypedArray(JSStructuredCloneWriter *w, jsval v)
|
||||
{
|
||||
JS_ASSERT(v.isObject());
|
||||
return w->writeTypedArray(&v.toObject());
|
||||
}
|
||||
|
||||
bool
|
||||
JSStructuredCloneWriter::writeTypedArray(JSObject *obj)
|
||||
{
|
||||
|
@ -696,16 +689,6 @@ JSStructuredCloneReader::readString(uint32_t nchars)
|
|||
return str;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ReadTypedArray(JSStructuredCloneReader *r, jsval *vp)
|
||||
{
|
||||
uint32_t tag, nelems;
|
||||
if (!r->input().readPair(&tag, &nelems))
|
||||
return false;
|
||||
JS_ASSERT(tag >= SCTAG_TYPED_ARRAY_MIN && tag <= SCTAG_TYPED_ARRAY_MAX);
|
||||
return r->readTypedArray(tag, nelems, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
JSStructuredCloneReader::readTypedArray(uint32_t tag, uint32_t nelems, Value *vp)
|
||||
{
|
||||
|
|
|
@ -143,8 +143,6 @@ struct JSStructuredCloneReader {
|
|||
|
||||
// Any value passed to JS_ReadStructuredClone.
|
||||
void *closure;
|
||||
|
||||
friend JSBool JS_ReadTypedArray(JSStructuredCloneReader *r, jsval *vp);
|
||||
};
|
||||
|
||||
struct JSStructuredCloneWriter {
|
||||
|
@ -198,8 +196,6 @@ struct JSStructuredCloneWriter {
|
|||
|
||||
// Any value passed to JS_WriteStructuredClone.
|
||||
void *closure;
|
||||
|
||||
friend JSBool JS_WriteTypedArray(JSStructuredCloneWriter *w, jsval v);
|
||||
};
|
||||
|
||||
#endif /* jsclone_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче