зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to f-t
This commit is contained in:
Коммит
b676e87405
|
@ -263,7 +263,6 @@ skip-if = true # disabled until the tree view is added
|
||||||
# it ever is (bug 480169)
|
# it ever is (bug 480169)
|
||||||
[browser_save_link-perwindowpb.js]
|
[browser_save_link-perwindowpb.js]
|
||||||
[browser_save_private_link_perwindowpb.js]
|
[browser_save_private_link_perwindowpb.js]
|
||||||
skip-if = os == "linux" # bug 857427
|
|
||||||
[browser_save_video.js]
|
[browser_save_video.js]
|
||||||
[browser_scope.js]
|
[browser_scope.js]
|
||||||
[browser_selectTabAtIndex.js]
|
[browser_selectTabAtIndex.js]
|
||||||
|
|
|
@ -36,45 +36,13 @@ function test() {
|
||||||
storage.asyncVisitStorage(new Visitor(), true /* Do walk entries */);
|
storage.asyncVisitStorage(new Visitor(), true /* Do walk entries */);
|
||||||
}
|
}
|
||||||
|
|
||||||
function contextMenuOpened(aWindow, event) {
|
|
||||||
cache.clear();
|
|
||||||
|
|
||||||
event.currentTarget.removeEventListener("popupshown", contextMenuOpened);
|
|
||||||
|
|
||||||
// Create the folder the image will be saved into.
|
|
||||||
var destDir = createTemporarySaveDirectory();
|
|
||||||
var destFile = destDir.clone();
|
|
||||||
|
|
||||||
MockFilePicker.displayDirectory = destDir;
|
|
||||||
MockFilePicker.showCallback = function(fp) {
|
|
||||||
fileName = fp.defaultString;
|
|
||||||
destFile.append (fileName);
|
|
||||||
MockFilePicker.returnFiles = [destFile];
|
|
||||||
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
|
|
||||||
};
|
|
||||||
|
|
||||||
mockTransferCallback = onTransferComplete;
|
|
||||||
mockTransferRegisterer.register();
|
|
||||||
|
|
||||||
registerCleanupFunction(function () {
|
|
||||||
mockTransferRegisterer.unregister();
|
|
||||||
MockFilePicker.cleanup();
|
|
||||||
destDir.remove(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Select "Save Image As" option from context menu
|
|
||||||
var saveVideoCommand = aWindow.document.getElementById("context-saveimage");
|
|
||||||
saveVideoCommand.doCommand();
|
|
||||||
|
|
||||||
event.target.hidePopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTransferComplete(downloadSuccess) {
|
function onTransferComplete(downloadSuccess) {
|
||||||
ok(downloadSuccess, "Image file should have been downloaded successfully");
|
ok(downloadSuccess, "Image file should have been downloaded successfully");
|
||||||
|
|
||||||
// Give the request a chance to finish and create a cache entry
|
// Give the request a chance to finish and create a cache entry
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
checkDiskCacheFor(fileName, finish);
|
checkDiskCacheFor(fileName, finish);
|
||||||
|
mockTransferCallback = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +57,39 @@ function test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function doTest(aIsPrivateMode, aWindow, aCallback) {
|
function doTest(aIsPrivateMode, aWindow, aCallback) {
|
||||||
|
function contextMenuOpened(event) {
|
||||||
|
cache.clear();
|
||||||
|
|
||||||
|
aWindow.document.removeEventListener("popupshown", contextMenuOpened);
|
||||||
|
|
||||||
|
// Create the folder the image will be saved into.
|
||||||
|
var destDir = createTemporarySaveDirectory();
|
||||||
|
var destFile = destDir.clone();
|
||||||
|
|
||||||
|
MockFilePicker.displayDirectory = destDir;
|
||||||
|
MockFilePicker.showCallback = function(fp) {
|
||||||
|
fileName = fp.defaultString;
|
||||||
|
destFile.append (fileName);
|
||||||
|
MockFilePicker.returnFiles = [destFile];
|
||||||
|
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
|
||||||
|
};
|
||||||
|
|
||||||
|
mockTransferCallback = onTransferComplete;
|
||||||
|
mockTransferRegisterer.register();
|
||||||
|
|
||||||
|
registerCleanupFunction(function () {
|
||||||
|
mockTransferRegisterer.unregister();
|
||||||
|
MockFilePicker.cleanup();
|
||||||
|
destDir.remove(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Select "Save Image As" option from context menu
|
||||||
|
var saveVideoCommand = aWindow.document.getElementById("context-saveimage");
|
||||||
|
saveVideoCommand.doCommand();
|
||||||
|
|
||||||
|
event.target.hidePopup();
|
||||||
|
}
|
||||||
|
|
||||||
aWindow.gBrowser.addEventListener("pageshow", function pageShown(event) {
|
aWindow.gBrowser.addEventListener("pageshow", function pageShown(event) {
|
||||||
// If data: -url PAC file isn't loaded soon enough, we may get about:privatebrowsing loaded
|
// If data: -url PAC file isn't loaded soon enough, we may get about:privatebrowsing loaded
|
||||||
if (event.target.location == "about:blank" ||
|
if (event.target.location == "about:blank" ||
|
||||||
|
@ -98,14 +99,13 @@ function test() {
|
||||||
}
|
}
|
||||||
aWindow.gBrowser.removeEventListener("pageshow", pageShown);
|
aWindow.gBrowser.removeEventListener("pageshow", pageShown);
|
||||||
|
|
||||||
executeSoon(function () {
|
waitForFocus(function () {
|
||||||
aWindow.document.addEventListener("popupshown",
|
aWindow.document.addEventListener("popupshown", contextMenuOpened, false);
|
||||||
function(e) contextMenuOpened(aWindow, e), false);
|
|
||||||
var img = aWindow.gBrowser.selectedBrowser.contentDocument.getElementById("img");
|
var img = aWindow.gBrowser.selectedBrowser.contentDocument.getElementById("img");
|
||||||
EventUtils.synthesizeMouseAtCenter(img,
|
EventUtils.synthesizeMouseAtCenter(img,
|
||||||
{ type: "contextmenu", button: 2 },
|
{ type: "contextmenu", button: 2 },
|
||||||
aWindow.gBrowser.contentWindow);
|
aWindow.gBrowser.contentWindow);
|
||||||
});
|
}, aWindow.gBrowser.selectedBrowser.contentWindow);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
// dst alpha is always 1.0. If this is never called, the context
|
// dst alpha is always 1.0. If this is never called, the context
|
||||||
// defaults to false (not opaque).
|
// defaults to false (not opaque).
|
||||||
NS_IMETHOD SetIsOpaque(bool isOpaque) = 0;
|
NS_IMETHOD SetIsOpaque(bool isOpaque) = 0;
|
||||||
|
virtual bool GetIsOpaque() = 0;
|
||||||
|
|
||||||
// Invalidate this context and release any held resources, in preperation
|
// Invalidate this context and release any held resources, in preperation
|
||||||
// for possibly reinitializing with SetDimensions/InitializeWithSurface.
|
// for possibly reinitializing with SetDimensions/InitializeWithSurface.
|
||||||
|
|
|
@ -988,6 +988,10 @@ CanvasRenderingContext2D::SetIsOpaque(bool isOpaque)
|
||||||
ClearTarget();
|
ClearTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mOpaque) {
|
||||||
|
EnsureTarget();
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,6 +1066,10 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value
|
||||||
mForceSoftware = attributes.mWillReadFrequently;
|
mForceSoftware = attributes.mWillReadFrequently;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!attributes.mAlpha) {
|
||||||
|
SetIsOpaque(true);
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3807,6 +3815,30 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
|
||||||
// inherited from Thebes canvas and is no longer true
|
// inherited from Thebes canvas and is no longer true
|
||||||
uint8_t* dst = data + dstWriteRect.y * (aWidth * 4) + dstWriteRect.x * 4;
|
uint8_t* dst = data + dstWriteRect.y * (aWidth * 4) + dstWriteRect.x * 4;
|
||||||
|
|
||||||
|
if (mOpaque) {
|
||||||
|
for (int32_t j = 0; j < dstWriteRect.height; ++j) {
|
||||||
|
for (int32_t i = 0; i < dstWriteRect.width; ++i) {
|
||||||
|
// XXX Is there some useful swizzle MMX we can use here?
|
||||||
|
#if MOZ_LITTLE_ENDIAN
|
||||||
|
uint8_t b = *src++;
|
||||||
|
uint8_t g = *src++;
|
||||||
|
uint8_t r = *src++;
|
||||||
|
src++;
|
||||||
|
#else
|
||||||
|
src++;
|
||||||
|
uint8_t r = *src++;
|
||||||
|
uint8_t g = *src++;
|
||||||
|
uint8_t b = *src++;
|
||||||
|
#endif
|
||||||
|
*dst++ = r;
|
||||||
|
*dst++ = g;
|
||||||
|
*dst++ = b;
|
||||||
|
*dst++ = 255;
|
||||||
|
}
|
||||||
|
src += srcStride - (dstWriteRect.width * 4);
|
||||||
|
dst += (aWidth * 4) - (dstWriteRect.width * 4);
|
||||||
|
}
|
||||||
|
} else
|
||||||
for (int32_t j = 0; j < dstWriteRect.height; ++j) {
|
for (int32_t j = 0; j < dstWriteRect.height; ++j) {
|
||||||
for (int32_t i = 0; i < dstWriteRect.width; ++i) {
|
for (int32_t i = 0; i < dstWriteRect.width; ++i) {
|
||||||
// XXX Is there some useful swizzle MMX we can use here?
|
// XXX Is there some useful swizzle MMX we can use here?
|
||||||
|
|
|
@ -408,6 +408,7 @@ public:
|
||||||
{ EnsureTarget(); return mTarget->Snapshot(); }
|
{ EnsureTarget(); return mTarget->Snapshot(); }
|
||||||
|
|
||||||
NS_IMETHOD SetIsOpaque(bool isOpaque) MOZ_OVERRIDE;
|
NS_IMETHOD SetIsOpaque(bool isOpaque) MOZ_OVERRIDE;
|
||||||
|
bool GetIsOpaque() MOZ_OVERRIDE { return mOpaque; }
|
||||||
NS_IMETHOD Reset() MOZ_OVERRIDE;
|
NS_IMETHOD Reset() MOZ_OVERRIDE;
|
||||||
already_AddRefed<CanvasLayer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
already_AddRefed<CanvasLayer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
||||||
CanvasLayer *aOldLayer,
|
CanvasLayer *aOldLayer,
|
||||||
|
|
|
@ -178,6 +178,7 @@ public:
|
||||||
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE;
|
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE;
|
||||||
|
|
||||||
NS_IMETHOD SetIsOpaque(bool b) MOZ_OVERRIDE { return NS_OK; };
|
NS_IMETHOD SetIsOpaque(bool b) MOZ_OVERRIDE { return NS_OK; };
|
||||||
|
bool GetIsOpaque() MOZ_OVERRIDE { return false; }
|
||||||
NS_IMETHOD SetContextOptions(JSContext* aCx,
|
NS_IMETHOD SetContextOptions(JSContext* aCx,
|
||||||
JS::Handle<JS::Value> aOptions) MOZ_OVERRIDE;
|
JS::Handle<JS::Value> aOptions) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
|
|
@ -21577,6 +21577,24 @@ function test_linedash() {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>Canvas test: test_opaque</p>
|
||||||
|
<canvas id="c688" width="150" height="50"></canvas>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function test_opaque() {
|
||||||
|
var c = document.getElementById("c688");
|
||||||
|
var ctx = c.getContext("2d", {alpha: false});
|
||||||
|
ctx.fillStyle = "green";
|
||||||
|
ctx.fillRect(0,0,10,10);
|
||||||
|
ctx.fillStyle = "rgba(255,0,0,.5)";
|
||||||
|
ctx.fillRect(10,0,10,10);
|
||||||
|
|
||||||
|
isPixel(ctx, 20, 20, 0, 0, 0, 255, 0);
|
||||||
|
isPixel(ctx, 5, 5, 0, 128, 0, 255, 0);
|
||||||
|
isPixel(ctx, 15, 5, 128, 0, 0, 255, 0);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function asyncTestsDone() {
|
function asyncTestsDone() {
|
||||||
|
@ -24873,6 +24891,12 @@ function runTests() {
|
||||||
throw e;
|
throw e;
|
||||||
ok(false, "unexpected exception thrown in: test_linedash");
|
ok(false, "unexpected exception thrown in: test_linedash");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
test_opaque();
|
||||||
|
} catch(e) {
|
||||||
|
throw e;
|
||||||
|
ok(false, "unexpected exception thrown in: test_opaque");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// run this test last since it replaces the getContext method
|
// run this test last since it replaces the getContext method
|
||||||
test_type_replace();
|
test_type_replace();
|
||||||
|
|
|
@ -781,7 +781,7 @@ HTMLCanvasElement::UpdateContext(JSContext* aCx, JS::Handle<JS::Value> aNewConte
|
||||||
|
|
||||||
nsIntSize sz = GetWidthHeight();
|
nsIntSize sz = GetWidthHeight();
|
||||||
|
|
||||||
nsresult rv = mCurrentContext->SetIsOpaque(GetIsOpaque());
|
nsresult rv = mCurrentContext->SetIsOpaque(HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
mCurrentContext = nullptr;
|
mCurrentContext = nullptr;
|
||||||
mCurrentContextId.Truncate();
|
mCurrentContextId.Truncate();
|
||||||
|
@ -903,6 +903,10 @@ HTMLCanvasElement::GetContextAtIndex(int32_t index)
|
||||||
bool
|
bool
|
||||||
HTMLCanvasElement::GetIsOpaque()
|
HTMLCanvasElement::GetIsOpaque()
|
||||||
{
|
{
|
||||||
|
if (mCurrentContext) {
|
||||||
|
return mCurrentContext->GetIsOpaque();
|
||||||
|
}
|
||||||
|
|
||||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque);
|
return HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<script type="application/javascript;version=1.7">
|
<script type="application/javascript;version=1.7">
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
SimpleTest.requestCompleteLog();
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
// Copied from EventUtils.js, but we want *ToWindow methods.
|
// Copied from EventUtils.js, but we want *ToWindow methods.
|
||||||
|
|
|
@ -60,7 +60,7 @@ moz_gfx_memory_reset(MozGfxMemory *mem)
|
||||||
mem->image->Release();
|
mem->image->Release();
|
||||||
|
|
||||||
ImageContainer* container = ((MozGfxMemoryAllocator*) mem->memory.allocator)->reader->GetImageContainer();
|
ImageContainer* container = ((MozGfxMemoryAllocator*) mem->memory.allocator)->reader->GetImageContainer();
|
||||||
mem->image = reinterpret_cast<PlanarYCbCrImage*>(container->CreateImage(ImageFormat::PLANAR_YCBCR).get());
|
mem->image = reinterpret_cast<PlanarYCbCrImage*>(container->CreateImage(ImageFormat::PLANAR_YCBCR).take());
|
||||||
mem->data = mem->image->AllocateAndGetNewBuffer(mem->memory.size);
|
mem->data = mem->image->AllocateAndGetNewBuffer(mem->memory.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ DOMInterfaces = {
|
||||||
},
|
},
|
||||||
|
|
||||||
'FileRequest': {
|
'FileRequest': {
|
||||||
'nativeType': 'mozilla::dom::file::DOMFileRequest',
|
'nativeType': 'mozilla::dom::file::FileRequest',
|
||||||
},
|
},
|
||||||
|
|
||||||
'FormData': [
|
'FormData': [
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 "DOMFileRequest.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/FileRequestBinding.h"
|
|
||||||
#include "LockedFile.h"
|
|
||||||
|
|
||||||
USING_FILE_NAMESPACE
|
|
||||||
|
|
||||||
DOMFileRequest::DOMFileRequest(nsPIDOMWindow* aWindow)
|
|
||||||
: FileRequest(aWindow)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
already_AddRefed<DOMFileRequest>
|
|
||||||
DOMFileRequest::Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> request = new DOMFileRequest(aOwner);
|
|
||||||
request->mLockedFile = aLockedFile;
|
|
||||||
|
|
||||||
return request.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* virtual */ JSObject*
|
|
||||||
DOMFileRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
|
||||||
{
|
|
||||||
return FileRequestBinding::Wrap(aCx, aScope, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIDOMLockedFile*
|
|
||||||
DOMFileRequest::GetLockedFile() const
|
|
||||||
{
|
|
||||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
|
||||||
return mLockedFile;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=2 et sw=2 tw=80: */
|
|
||||||
/* 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_file_DOMFileRequest_h
|
|
||||||
#define mozilla_dom_file_DOMFileRequest_h
|
|
||||||
|
|
||||||
#include "FileRequest.h"
|
|
||||||
|
|
||||||
class nsIDOMLockedFile;
|
|
||||||
|
|
||||||
BEGIN_FILE_NAMESPACE
|
|
||||||
|
|
||||||
class DOMFileRequest : public FileRequest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static already_AddRefed<DOMFileRequest>
|
|
||||||
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile);
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx,
|
|
||||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
nsIDOMLockedFile* GetLockedFile() const;
|
|
||||||
IMPL_EVENT_HANDLER(progress)
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DOMFileRequest(nsPIDOMWindow* aWindow);
|
|
||||||
};
|
|
||||||
|
|
||||||
END_FILE_NAMESPACE
|
|
||||||
|
|
||||||
#endif // mozilla_dom_file_DOMFileRequest_h
|
|
|
@ -164,7 +164,8 @@ FileHandle::GetFile(ErrorResult& aError)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<FileRequest> request = FileRequest::Create(GetOwner(), lockedFile);
|
nsRefPtr<FileRequest> request =
|
||||||
|
FileRequest::Create(GetOwner(), lockedFile, /* aWrapAsDOMRequest */ true);
|
||||||
|
|
||||||
nsRefPtr<MetadataParameters> params = new MetadataParameters(true, false);
|
nsRefPtr<MetadataParameters> params = new MetadataParameters(true, false);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "FileRequest.h"
|
#include "FileRequest.h"
|
||||||
|
|
||||||
#include "DOMFileRequest.h"
|
#include "mozilla/dom/FileRequestBinding.h"
|
||||||
#include "nsCxPusher.h"
|
#include "nsCxPusher.h"
|
||||||
#include "nsEventDispatcher.h"
|
#include "nsEventDispatcher.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
USING_FILE_NAMESPACE
|
USING_FILE_NAMESPACE
|
||||||
|
|
||||||
FileRequest::FileRequest(nsPIDOMWindow* aWindow)
|
FileRequest::FileRequest(nsPIDOMWindow* aWindow)
|
||||||
: DOMRequest(aWindow)
|
: DOMRequest(aWindow), mWrapAsDOMRequest(false)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,14 @@ FileRequest::~FileRequest()
|
||||||
|
|
||||||
// static
|
// static
|
||||||
already_AddRefed<FileRequest>
|
already_AddRefed<FileRequest>
|
||||||
FileRequest::Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile)
|
FileRequest::Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile,
|
||||||
|
bool aWrapAsDOMRequest)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||||
|
|
||||||
nsRefPtr<FileRequest> request = new FileRequest(aOwner);
|
nsRefPtr<FileRequest> request = new FileRequest(aOwner);
|
||||||
request->mLockedFile = aLockedFile;
|
request->mLockedFile = aLockedFile;
|
||||||
|
request->mWrapAsDOMRequest = aWrapAsDOMRequest;
|
||||||
|
|
||||||
return request.forget();
|
return request.forget();
|
||||||
}
|
}
|
||||||
|
@ -101,6 +103,23 @@ NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
|
||||||
NS_IMPL_ADDREF_INHERITED(FileRequest, DOMRequest)
|
NS_IMPL_ADDREF_INHERITED(FileRequest, DOMRequest)
|
||||||
NS_IMPL_RELEASE_INHERITED(FileRequest, DOMRequest)
|
NS_IMPL_RELEASE_INHERITED(FileRequest, DOMRequest)
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
JSObject*
|
||||||
|
FileRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||||
|
{
|
||||||
|
if (mWrapAsDOMRequest) {
|
||||||
|
return DOMRequest::WrapObject(aCx, aScope);
|
||||||
|
}
|
||||||
|
return FileRequestBinding::Wrap(aCx, aScope, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIDOMLockedFile*
|
||||||
|
FileRequest::GetLockedFile() const
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
|
||||||
|
return mLockedFile;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileRequest::FireProgressEvent(uint64_t aLoaded, uint64_t aTotal)
|
FileRequest::FireProgressEvent(uint64_t aLoaded, uint64_t aTotal)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include "DOMRequest.h"
|
#include "DOMRequest.h"
|
||||||
|
|
||||||
|
class nsIDOMLockedFile;
|
||||||
|
|
||||||
BEGIN_FILE_NAMESPACE
|
BEGIN_FILE_NAMESPACE
|
||||||
|
|
||||||
class FileHelper;
|
class FileHelper;
|
||||||
|
@ -24,7 +26,8 @@ public:
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
|
||||||
|
|
||||||
static already_AddRefed<FileRequest>
|
static already_AddRefed<FileRequest>
|
||||||
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile);
|
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile,
|
||||||
|
bool aWrapAsDOMRequest);
|
||||||
|
|
||||||
// nsIDOMEventTarget
|
// nsIDOMEventTarget
|
||||||
virtual nsresult
|
virtual nsresult
|
||||||
|
@ -39,6 +42,16 @@ public:
|
||||||
nsresult
|
nsresult
|
||||||
NotifyHelperCompleted(FileHelper* aFileHelper);
|
NotifyHelperCompleted(FileHelper* aFileHelper);
|
||||||
|
|
||||||
|
// nsWrapperCache
|
||||||
|
virtual JSObject*
|
||||||
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
nsIDOMLockedFile*
|
||||||
|
GetLockedFile() const;
|
||||||
|
|
||||||
|
IMPL_EVENT_HANDLER(progress)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FileRequest(nsPIDOMWindow* aWindow);
|
FileRequest(nsPIDOMWindow* aWindow);
|
||||||
~FileRequest();
|
~FileRequest();
|
||||||
|
@ -47,6 +60,8 @@ protected:
|
||||||
FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
|
FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
|
||||||
|
|
||||||
nsRefPtr<LockedFile> mLockedFile;
|
nsRefPtr<LockedFile> mLockedFile;
|
||||||
|
|
||||||
|
bool mWrapAsDOMRequest;
|
||||||
};
|
};
|
||||||
|
|
||||||
END_FILE_NAMESPACE
|
END_FILE_NAMESPACE
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
|
|
||||||
#include "AsyncHelper.h"
|
#include "AsyncHelper.h"
|
||||||
#include "DOMFileRequest.h"
|
|
||||||
#include "FileHandle.h"
|
#include "FileHandle.h"
|
||||||
#include "FileHelper.h"
|
#include "FileHelper.h"
|
||||||
|
#include "FileRequest.h"
|
||||||
#include "FileService.h"
|
#include "FileService.h"
|
||||||
#include "FileStreamWrappers.h"
|
#include "FileStreamWrappers.h"
|
||||||
#include "MemoryStreams.h"
|
#include "MemoryStreams.h"
|
||||||
|
@ -420,11 +420,11 @@ LockedFile::GetOrCreateStream(nsISupports** aStream)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMFileRequest>
|
already_AddRefed<FileRequest>
|
||||||
LockedFile::GenerateFileRequest()
|
LockedFile::GenerateFileRequest()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||||
return DOMFileRequest::Create(GetOwner(), this);
|
return FileRequest::Create(GetOwner(), this, /* aWrapAsDOMRequest */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -556,7 +556,7 @@ LockedFile::GetMetadata(JS::Handle<JS::Value> aParameters,
|
||||||
return NS_ERROR_TYPE_ERR;
|
return NS_ERROR_TYPE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
nsRefPtr<MetadataHelper> helper =
|
nsRefPtr<MetadataHelper> helper =
|
||||||
new MetadataHelper(this, fileRequest, params);
|
new MetadataHelper(this, fileRequest, params);
|
||||||
|
@ -593,7 +593,7 @@ LockedFile::ReadAsArrayBuffer(uint64_t aSize,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
nsRefPtr<ReadHelper> helper =
|
nsRefPtr<ReadHelper> helper =
|
||||||
new ReadHelper(this, fileRequest, mLocation, aSize);
|
new ReadHelper(this, fileRequest, mLocation, aSize);
|
||||||
|
@ -635,7 +635,7 @@ LockedFile::ReadAsText(uint64_t aSize,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
nsRefPtr<ReadTextHelper> helper =
|
nsRefPtr<ReadTextHelper> helper =
|
||||||
new ReadTextHelper(this, fileRequest, mLocation, aSize, aEncoding);
|
new ReadTextHelper(this, fileRequest, mLocation, aSize, aEncoding);
|
||||||
|
@ -706,7 +706,7 @@ LockedFile::Truncate(uint64_t aSize,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
nsRefPtr<TruncateHelper> helper =
|
nsRefPtr<TruncateHelper> helper =
|
||||||
new TruncateHelper(this, fileRequest, location);
|
new TruncateHelper(this, fileRequest, location);
|
||||||
|
@ -741,7 +741,7 @@ LockedFile::Flush(nsISupports** _retval)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
nsRefPtr<FlushHelper> helper = new FlushHelper(this, fileRequest);
|
nsRefPtr<FlushHelper> helper = new FlushHelper(this, fileRequest);
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ LockedFile::WriteOrAppend(JS::Handle<JS::Value> aValue,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<DOMFileRequest> fileRequest = GenerateFileRequest();
|
nsRefPtr<FileRequest> fileRequest = GenerateFileRequest();
|
||||||
|
|
||||||
uint64_t location = aAppend ? UINT64_MAX : mLocation;
|
uint64_t location = aAppend ? UINT64_MAX : mLocation;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ class nsIInputStream;
|
||||||
|
|
||||||
BEGIN_FILE_NAMESPACE
|
BEGIN_FILE_NAMESPACE
|
||||||
|
|
||||||
class DOMFileRequest;
|
|
||||||
class FileHandle;
|
class FileHandle;
|
||||||
class FileRequest;
|
class FileRequest;
|
||||||
class MetadataHelper;
|
class MetadataHelper;
|
||||||
|
@ -98,7 +97,7 @@ private:
|
||||||
void
|
void
|
||||||
OnRequestFinished();
|
OnRequestFinished();
|
||||||
|
|
||||||
inline already_AddRefed<DOMFileRequest>
|
already_AddRefed<FileRequest>
|
||||||
GenerateFileRequest();
|
GenerateFileRequest();
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -22,11 +22,11 @@ EXPORTS.mozilla.dom.file += [
|
||||||
'ArchiveRequest.h',
|
'ArchiveRequest.h',
|
||||||
'ArchiveZipEvent.h',
|
'ArchiveZipEvent.h',
|
||||||
'ArchiveZipFile.h',
|
'ArchiveZipFile.h',
|
||||||
'DOMFileRequest.h',
|
|
||||||
'File.h',
|
'File.h',
|
||||||
'FileCommon.h',
|
'FileCommon.h',
|
||||||
'FileHandle.h',
|
'FileHandle.h',
|
||||||
'FileHelper.h',
|
'FileHelper.h',
|
||||||
|
'FileRequest.h',
|
||||||
'FileService.h',
|
'FileService.h',
|
||||||
'LockedFile.h',
|
'LockedFile.h',
|
||||||
]
|
]
|
||||||
|
@ -38,7 +38,6 @@ UNIFIED_SOURCES += [
|
||||||
'ArchiveZipEvent.cpp',
|
'ArchiveZipEvent.cpp',
|
||||||
'ArchiveZipFile.cpp',
|
'ArchiveZipFile.cpp',
|
||||||
'AsyncHelper.cpp',
|
'AsyncHelper.cpp',
|
||||||
'DOMFileRequest.cpp',
|
|
||||||
'File.cpp',
|
'File.cpp',
|
||||||
'FileHandle.cpp',
|
'FileHandle.cpp',
|
||||||
'FileHelper.cpp',
|
'FileHelper.cpp',
|
||||||
|
|
|
@ -13,6 +13,8 @@ skip-if = buildapp == 'b2g'
|
||||||
[test_archivereader_zip_in_zip.html]
|
[test_archivereader_zip_in_zip.html]
|
||||||
skip-if = buildapp == 'b2g'
|
skip-if = buildapp == 'b2g'
|
||||||
[test_bug_793311.html]
|
[test_bug_793311.html]
|
||||||
|
[test_getFile.html]
|
||||||
|
skip-if = buildapp == 'b2g'
|
||||||
[test_getFileId.html]
|
[test_getFileId.html]
|
||||||
[test_location.html]
|
[test_location.html]
|
||||||
skip-if = buildapp == 'b2g'
|
skip-if = buildapp == 'b2g'
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<!--
|
||||||
|
Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>File Handle Test</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript;version=1.7">
|
||||||
|
function testSteps()
|
||||||
|
{
|
||||||
|
for each (let fileStorage in fileStorages) {
|
||||||
|
let request = getFileHandle(fileStorage.key, "test.txt");
|
||||||
|
request.onerror = errorHandler;
|
||||||
|
request.onsuccess = grabEventAndContinueHandler;
|
||||||
|
let event = yield undefined;
|
||||||
|
|
||||||
|
let fileHandle = event.target.result;
|
||||||
|
fileHandle.onerror = errorHandler;
|
||||||
|
|
||||||
|
request = fileHandle.getFile();
|
||||||
|
ok(request instanceof DOMRequest, "Correct interface");
|
||||||
|
ok(!(request instanceof FileRequest), "Correct interface");
|
||||||
|
ok(!('lockedFile' in request), "Property should not exist");
|
||||||
|
ok(request.lockedFile === undefined, "Property should not exist");
|
||||||
|
ok(!('onprogress' in request), "Property should not exist");
|
||||||
|
ok(request.onprogress === undefined, "Property should not exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
finishTest();
|
||||||
|
yield undefined;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="runTest();"></body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -16,6 +16,8 @@ enum CanvasWindingRule { "nonzero", "evenodd" };
|
||||||
dictionary ContextAttributes2D {
|
dictionary ContextAttributes2D {
|
||||||
// whether or not we're planning to do a lot of readback operations
|
// whether or not we're planning to do a lot of readback operations
|
||||||
boolean willReadFrequently = false;
|
boolean willReadFrequently = false;
|
||||||
|
// signal if the canvas contains an alpha channel
|
||||||
|
boolean alpha = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary HitRegionOptions {
|
dictionary HitRegionOptions {
|
||||||
|
|
|
@ -309,9 +309,9 @@ StructTypeRepresentation::init(JSContext *cx,
|
||||||
|
|
||||||
// We compute alignment into the field `align_` directly in the
|
// We compute alignment into the field `align_` directly in the
|
||||||
// loop below, but not `size_` because we have to very careful
|
// loop below, but not `size_` because we have to very careful
|
||||||
// about overflow. For now, we always use a uint32_t for
|
// about overflow. For now, we always use a int32_t for
|
||||||
// consistency across build environments.
|
// consistency across build environments.
|
||||||
uint32_t totalSize = 0;
|
int32_t totalSize = 0;
|
||||||
|
|
||||||
// These will be adjusted in the loop below:
|
// These will be adjusted in the loop below:
|
||||||
alignment_ = 1;
|
alignment_ = 1;
|
||||||
|
@ -324,7 +324,7 @@ StructTypeRepresentation::init(JSContext *cx,
|
||||||
if (fieldTypeRepr->opaque())
|
if (fieldTypeRepr->opaque())
|
||||||
opaque_ = true;
|
opaque_ = true;
|
||||||
|
|
||||||
uint32_t alignedSize = alignTo(totalSize, fieldTypeRepr->alignment());
|
int32_t alignedSize = alignTo(totalSize, fieldTypeRepr->alignment());
|
||||||
if (alignedSize < totalSize) {
|
if (alignedSize < totalSize) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||||
|
@ -335,7 +335,7 @@ StructTypeRepresentation::init(JSContext *cx,
|
||||||
fieldTypeRepr, alignedSize);
|
fieldTypeRepr, alignedSize);
|
||||||
alignment_ = js::Max(alignment_, fieldTypeRepr->alignment());
|
alignment_ = js::Max(alignment_, fieldTypeRepr->alignment());
|
||||||
|
|
||||||
uint32_t incrementedSize = alignedSize + fieldTypeRepr->size();
|
int32_t incrementedSize = alignedSize + fieldTypeRepr->size();
|
||||||
if (incrementedSize < alignedSize) {
|
if (incrementedSize < alignedSize) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||||
|
@ -345,7 +345,7 @@ StructTypeRepresentation::init(JSContext *cx,
|
||||||
totalSize = incrementedSize;
|
totalSize = incrementedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t alignedSize = alignTo(totalSize, alignment_);
|
int32_t alignedSize = alignTo(totalSize, alignment_);
|
||||||
if (alignedSize < totalSize) {
|
if (alignedSize < totalSize) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||||
JSMSG_TYPEDOBJECT_TOO_BIG);
|
JSMSG_TYPEDOBJECT_TOO_BIG);
|
||||||
|
|
|
@ -2301,6 +2301,12 @@ TypedObject::constructSized(JSContext *cx, unsigned int argc, Value *vp)
|
||||||
Rooted<ArrayBufferObject*> buffer(cx);
|
Rooted<ArrayBufferObject*> buffer(cx);
|
||||||
buffer = &args[0].toObject().as<ArrayBufferObject>();
|
buffer = &args[0].toObject().as<ArrayBufferObject>();
|
||||||
|
|
||||||
|
if (buffer->isNeutered()) {
|
||||||
|
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||||
|
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
if (args.length() >= 2 && !args[1].isUndefined()) {
|
if (args.length() >= 2 && !args[1].isUndefined()) {
|
||||||
if (!args[1].isInt32()) {
|
if (!args[1].isInt32()) {
|
||||||
|
@ -2407,6 +2413,12 @@ TypedObject::constructUnsized(JSContext *cx, unsigned int argc, Value *vp)
|
||||||
Rooted<ArrayBufferObject*> buffer(cx);
|
Rooted<ArrayBufferObject*> buffer(cx);
|
||||||
buffer = &args[0].toObject().as<ArrayBufferObject>();
|
buffer = &args[0].toObject().as<ArrayBufferObject>();
|
||||||
|
|
||||||
|
if (buffer->isNeutered()) {
|
||||||
|
JS_ReportErrorNumber(cx, js_GetErrorMessage,
|
||||||
|
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
if (args.length() >= 2 && !args[1].isUndefined()) {
|
if (args.length() >= 2 && !args[1].isUndefined()) {
|
||||||
if (!args[1].isInt32()) {
|
if (!args[1].isInt32()) {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Bug 976697. Check for various quirks when instantiating a typed
|
||||||
|
// object atop an already neutered buffer.
|
||||||
|
|
||||||
|
if (typeof TypedObject === "undefined")
|
||||||
|
quit();
|
||||||
|
|
||||||
|
load(libdir + "asserts.js")
|
||||||
|
|
||||||
|
var {StructType, uint32, Object, Any, storage, objectType} = TypedObject;
|
||||||
|
|
||||||
|
function main() { // once a C programmer, always a C programmer.
|
||||||
|
var Uints = uint32.array();
|
||||||
|
var Unit = new StructType({}); // Empty struct type
|
||||||
|
var buffer = new ArrayBuffer(0); // Empty buffer
|
||||||
|
var p = new Unit(buffer); // OK
|
||||||
|
neuter(buffer);
|
||||||
|
assertThrowsInstanceOf(() => new Unit(buffer), TypeError,
|
||||||
|
"Able to instantiate atop neutered buffer");
|
||||||
|
assertThrowsInstanceOf(() => new Uints(buffer, 0), TypeError,
|
||||||
|
"Able to instantiate atop neutered buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
|
@ -0,0 +1,10 @@
|
||||||
|
// |jit-test| error:Error
|
||||||
|
|
||||||
|
// Test that we don't permit structs whose fields exceed 32 bits.
|
||||||
|
|
||||||
|
if (!this.hasOwnProperty("TypedObject"))
|
||||||
|
throw new Error();
|
||||||
|
|
||||||
|
var Vec3u16Type = TypedObject.uint16.array((1073741823));
|
||||||
|
var PairVec3u16Type = new TypedObject.StructType({ fst: Vec3u16Type, snd: Vec3u16Type });
|
||||||
|
new PairVec3u16Type();
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Test that instantiating a typed array on top of a neutered buffer
|
||||||
|
// doesn't trip any asserts.
|
||||||
|
//
|
||||||
|
// Any copyright is dedicated to the Public Domain.
|
||||||
|
// http://creativecommons.org/licenses/publicdomain/
|
||||||
|
|
||||||
|
if (!this.hasOwnProperty("TypedObject"))
|
||||||
|
quit();
|
||||||
|
|
||||||
|
x = ArrayBuffer();
|
||||||
|
neuter(x);
|
||||||
|
Uint32Array(x);
|
||||||
|
gc();
|
|
@ -1807,11 +1807,6 @@ Assembler::placeConstantPoolBarrier(int offset)
|
||||||
// this is still an active path, however, we do not hit it in the test
|
// this is still an active path, however, we do not hit it in the test
|
||||||
// suite at all.
|
// suite at all.
|
||||||
MOZ_ASSUME_UNREACHABLE("ARMAssembler holdover");
|
MOZ_ASSUME_UNREACHABLE("ARMAssembler holdover");
|
||||||
#if 0
|
|
||||||
offset = (offset - sizeof(ARMWord)) >> 2;
|
|
||||||
ASSERT((offset <= BOFFSET_MAX && offset >= BOFFSET_MIN));
|
|
||||||
return AL | B | (offset & BRANCH_MASK);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Control flow stuff:
|
// Control flow stuff:
|
||||||
|
|
|
@ -13,54 +13,6 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace js::jit;
|
using namespace js::jit;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// no clue what these asserts should be.
|
|
||||||
JS_STATIC_ASSERT(sizeof(BailoutStack) ==
|
|
||||||
sizeof(uintptr_t) +
|
|
||||||
sizeof(double) * 8 +
|
|
||||||
sizeof(uintptr_t) * 8 +
|
|
||||||
sizeof(uintptr_t));
|
|
||||||
|
|
||||||
JS_STATIC_ASSERT(sizeof(ExtendedBailoutStack) ==
|
|
||||||
sizeof(BailoutStack) +
|
|
||||||
sizeof(uintptr_t));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
BailoutEnvironment::BailoutEnvironment(JitCompartment *ion, void **sp)
|
|
||||||
: sp_(sp)
|
|
||||||
{
|
|
||||||
bailout_ = reinterpret_cast<ExtendedBailoutStack *>(sp);
|
|
||||||
|
|
||||||
if (bailout_->frameClass() != FrameSizeClass::None()) {
|
|
||||||
frameSize_ = bailout_->frameSize();
|
|
||||||
frame_ = &sp_[sizeof(BailoutStack) / sizeof(void *)];
|
|
||||||
|
|
||||||
// Compute the bailout ID.
|
|
||||||
JitCode *code = ion->getBailoutTable(bailout_->frameClass());
|
|
||||||
uintptr_t tableOffset = bailout_->tableOffset();
|
|
||||||
uintptr_t tableStart = reinterpret_cast<uintptr_t>(code->raw());
|
|
||||||
|
|
||||||
JS_ASSERT(tableOffset >= tableStart &&
|
|
||||||
tableOffset < tableStart + code->instructionsSize());
|
|
||||||
JS_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0);
|
|
||||||
|
|
||||||
bailoutId_ = ((tableOffset - tableStart) / BAILOUT_TABLE_ENTRY_SIZE) - 1;
|
|
||||||
JS_ASSERT(bailoutId_ < BAILOUT_TABLE_SIZE);
|
|
||||||
} else {
|
|
||||||
frameSize_ = bailout_->frameSize();
|
|
||||||
frame_ = &sp_[sizeof(ExtendedBailoutStack) / sizeof(void *)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IonFramePrefix *
|
|
||||||
BailoutEnvironment::top() const
|
|
||||||
{
|
|
||||||
return (IonFramePrefix *)&frame_[frameSize_ / sizeof(void *)];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
namespace jit {
|
namespace jit {
|
||||||
|
|
||||||
|
|
|
@ -242,23 +242,8 @@ CodeGeneratorARM::bailoutFrom(Label *label, LSnapshot *snapshot)
|
||||||
// isn't properly aligned to the static frame size.
|
// isn't properly aligned to the static frame size.
|
||||||
JS_ASSERT_IF(frameClass_ != FrameSizeClass::None(),
|
JS_ASSERT_IF(frameClass_ != FrameSizeClass::None(),
|
||||||
frameClass_.frameSize() == masm.framePushed());
|
frameClass_.frameSize() == masm.framePushed());
|
||||||
// This involves retargeting a label, which I've declared is always going
|
|
||||||
// to be a pc-relative branch to an absolute address!
|
// On ARM we don't use a bailout table.
|
||||||
// With no assurance that this is going to be a local branch, I am wary to
|
|
||||||
// implement this. Moreover, If it isn't a local branch, it will be large
|
|
||||||
// and possibly slow. I believe that the correct way to handle this is to
|
|
||||||
// subclass label into a fatlabel, where we generate enough room for a load
|
|
||||||
// before the branch
|
|
||||||
#if 0
|
|
||||||
if (assignBailoutId(snapshot)) {
|
|
||||||
uint8_t *code = deoptTable_->raw() + snapshot->bailoutId() * BAILOUT_TABLE_ENTRY_SIZE;
|
|
||||||
masm.retarget(label, code, Relocation::HARDCODED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// We could not use a jump table, either because all bailout IDs were
|
|
||||||
// reserved, or a jump table is not optimal for this frame size or
|
|
||||||
// platform. Whatever, we will generate a lazy bailout.
|
|
||||||
OutOfLineBailout *ool = new(alloc()) OutOfLineBailout(snapshot, masm.framePushed());
|
OutOfLineBailout *ool = new(alloc()) OutOfLineBailout(snapshot, masm.framePushed());
|
||||||
if (!addOutOfLineCode(ool)) {
|
if (!addOutOfLineCode(ool)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1661,14 +1646,6 @@ CodeGeneratorARM::visitNotD(LNotD *ins)
|
||||||
masm.ma_mov(Imm32(0), dest);
|
masm.ma_mov(Imm32(0), dest);
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Equal);
|
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Equal);
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Overflow);
|
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Overflow);
|
||||||
#if 0
|
|
||||||
masm.as_vmrs(ToRegister(dest));
|
|
||||||
// Mask out just the two bits we care about. If neither bit is set,
|
|
||||||
// the dest is already zero
|
|
||||||
masm.ma_and(Imm32(0x50000000), dest, dest, Assembler::SetCond);
|
|
||||||
// If it is non-zero, then force it to be 1.
|
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::NotEqual);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1698,14 +1675,6 @@ CodeGeneratorARM::visitNotF(LNotF *ins)
|
||||||
masm.ma_mov(Imm32(0), dest);
|
masm.ma_mov(Imm32(0), dest);
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Equal);
|
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Equal);
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Overflow);
|
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::Overflow);
|
||||||
#if 0
|
|
||||||
masm.as_vmrs(ToRegister(dest));
|
|
||||||
// Mask out just the two bits we care about. If neither bit is set,
|
|
||||||
// the dest is already zero
|
|
||||||
masm.ma_and(Imm32(0x50000000), dest, dest, Assembler::SetCond);
|
|
||||||
// If it is non-zero, then force it to be 1.
|
|
||||||
masm.ma_mov(Imm32(1), dest, NoSetCond, Assembler::NotEqual);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,18 +148,6 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type)
|
||||||
masm.loadPtr(slot_vp, r10);
|
masm.loadPtr(slot_vp, r10);
|
||||||
masm.unboxInt32(Address(r10, 0), r10);
|
masm.unboxInt32(Address(r10, 0), r10);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// This is in case we want to go back to using frames that
|
|
||||||
// aren't 8 byte alinged
|
|
||||||
// there are r1 2-word arguments to the js code
|
|
||||||
// we want 2 word alignment, so this shouldn't matter.
|
|
||||||
// After the arguments have been pushed, we want to push an additional 3 words of
|
|
||||||
// data, so in all, we want to decrease sp by 4 if it is currently aligned to
|
|
||||||
// 8, and not touch it otherwise
|
|
||||||
aasm->as_sub(sp, sp, Imm8(4));
|
|
||||||
aasm->as_orr(sp, sp, Imm8(4));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Subtract off the size of the arguments from the stack pointer, store elsewhere
|
// Subtract off the size of the arguments from the stack pointer, store elsewhere
|
||||||
aasm->as_sub(r4, sp, O2RegImmShift(r1, LSL, 3)); //r4 = sp - argc*8
|
aasm->as_sub(r4, sp, O2RegImmShift(r1, LSL, 3)); //r4 = sp - argc*8
|
||||||
// Get the final position of the stack pointer into the stack pointer
|
// Get the final position of the stack pointer into the stack pointer
|
||||||
|
|
|
@ -303,6 +303,7 @@ static ObjectElements *
|
||||||
AllocateArrayBufferContents(JSContext *maybecx, uint32_t nbytes, void *oldptr = nullptr)
|
AllocateArrayBufferContents(JSContext *maybecx, uint32_t nbytes, void *oldptr = nullptr)
|
||||||
{
|
{
|
||||||
uint32_t size = nbytes + sizeof(ObjectElements);
|
uint32_t size = nbytes + sizeof(ObjectElements);
|
||||||
|
JS_ASSERT(size > nbytes); // be wary of rollover
|
||||||
ObjectElements *newheader;
|
ObjectElements *newheader;
|
||||||
|
|
||||||
// if oldptr is given, then we need to do a realloc
|
// if oldptr is given, then we need to do a realloc
|
||||||
|
|
|
@ -302,7 +302,14 @@ InitArrayBufferViewDataPointer(ArrayBufferViewObject *obj, ArrayBufferObject *bu
|
||||||
* private data rather than a slot to avoid alignment restrictions
|
* private data rather than a slot to avoid alignment restrictions
|
||||||
* on private Values.
|
* on private Values.
|
||||||
*/
|
*/
|
||||||
obj->initPrivate(buffer->dataPointer() + byteOffset);
|
|
||||||
|
if (buffer->isNeutered()) {
|
||||||
|
JS_ASSERT(byteOffset == 0);
|
||||||
|
obj->initPrivate(nullptr);
|
||||||
|
} else {
|
||||||
|
obj->initPrivate(buffer->dataPointer() + byteOffset);
|
||||||
|
}
|
||||||
|
|
||||||
PostBarrierTypedArrayObject(obj);
|
PostBarrierTypedArrayObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject
|
||||||
uint32_t bufferByteLength = buffer->byteLength();
|
uint32_t bufferByteLength = buffer->byteLength();
|
||||||
uint32_t arrayByteLength = obj->byteLength();
|
uint32_t arrayByteLength = obj->byteLength();
|
||||||
uint32_t arrayByteOffset = obj->byteOffset();
|
uint32_t arrayByteOffset = obj->byteOffset();
|
||||||
JS_ASSERT(buffer->dataPointer() <= obj->viewData());
|
JS_ASSERT_IF(!buffer->isNeutered(), buffer->dataPointer() <= obj->viewData());
|
||||||
JS_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength);
|
JS_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength);
|
||||||
JS_ASSERT(arrayByteOffset <= bufferByteLength);
|
JS_ASSERT(arrayByteOffset <= bufferByteLength);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ const Ci = SpecialPowers.Ci;
|
||||||
const Cc = SpecialPowers.Cc;
|
const Cc = SpecialPowers.Cc;
|
||||||
const Cr = SpecialPowers.Cr;
|
const Cr = SpecialPowers.Cr;
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
var testpath = "/tests/toolkit/components/passwordmgr/test/";
|
var testpath = "/tests/toolkit/components/passwordmgr/test/";
|
||||||
var prefix = "http://test2.example.com" + testpath;
|
var prefix = "http://test2.example.com" + testpath;
|
||||||
var subtests = [
|
var subtests = [
|
||||||
|
@ -191,24 +193,35 @@ var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
var contentPage = "http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/privbrowsing_perwindowpb_iframe.html";
|
var contentPage = "http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/privbrowsing_perwindowpb_iframe.html";
|
||||||
var testWindows = [];
|
var testWindows = [];
|
||||||
|
|
||||||
|
function whenDelayedStartupFinished(aWindow, aCallback) {
|
||||||
|
Services.obs.addObserver(function observer(aSubject, aTopic) {
|
||||||
|
if (aWindow == aSubject) {
|
||||||
|
Services.obs.removeObserver(observer, aTopic);
|
||||||
|
setTimeout(aCallback, 0);
|
||||||
|
}
|
||||||
|
}, "browser-delayed-startup-finished", false);
|
||||||
|
}
|
||||||
|
|
||||||
function testOnWindow(aIsPrivate, aCallback) {
|
function testOnWindow(aIsPrivate, aCallback) {
|
||||||
var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
|
var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
|
||||||
win.addEventListener("load", function onLoad() {
|
win.addEventListener("load", function onLoad() {
|
||||||
win.removeEventListener("load", onLoad, false);
|
win.removeEventListener("load", onLoad, false);
|
||||||
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
whenDelayedStartupFinished(win, function() {
|
||||||
if (win.content.location.href != contentPage) {
|
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
|
||||||
win.gBrowser.loadURI(contentPage);
|
if (win.content.location.href != contentPage) {
|
||||||
return;
|
win.gBrowser.loadURI(contentPage);
|
||||||
}
|
return;
|
||||||
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
}
|
||||||
|
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
|
||||||
|
|
||||||
win.content.addEventListener('load', function innerLoad2() {
|
win.content.addEventListener('load', function innerLoad2() {
|
||||||
win.content.removeEventListener('load', innerLoad2, false);
|
win.content.removeEventListener('load', innerLoad2, false);
|
||||||
testWindows.push(win);
|
testWindows.push(win);
|
||||||
SimpleTest.executeSoon(function() { aCallback(win); });
|
SimpleTest.executeSoon(function() { aCallback(win); });
|
||||||
}, false, true);
|
}, false, true);
|
||||||
}, true);
|
}, true);
|
||||||
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
|
||||||
|
});
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
SimpleTest.requestCompleteLog();
|
||||||
|
|
||||||
var expected = [ "one", "_extra2", "tab", "one", "tabbutton2", "tabbutton", "two", "textbox-yes", "one" ];
|
var expected = [ "one", "_extra2", "tab", "one", "tabbutton2", "tabbutton", "two", "textbox-yes", "one" ];
|
||||||
// non-Mac will always focus the default button if any of the dialog buttons
|
// non-Mac will always focus the default button if any of the dialog buttons
|
||||||
|
@ -39,13 +40,16 @@ function startTest()
|
||||||
var testButton = document.getElementById("test");
|
var testButton = document.getElementById("test");
|
||||||
synthesizeKey("VK_TAB", { });
|
synthesizeKey("VK_TAB", { });
|
||||||
fullKeyboardAccess = (document.activeElement == testButton);
|
fullKeyboardAccess = (document.activeElement == testButton);
|
||||||
|
info("We " + (fullKeyboardAccess ? "have" : "don't have") + " full keyboard access");
|
||||||
runTest();
|
runTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTest()
|
function runTest()
|
||||||
{
|
{
|
||||||
step++;
|
step++;
|
||||||
|
info("runTest(), step = " + step + ", expected = " + expected[step - 1]);
|
||||||
if (step > expected.length || (!fullKeyboardAccess && step == 2)) {
|
if (step > expected.length || (!fullKeyboardAccess && step == 2)) {
|
||||||
|
info("finishing");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,11 +59,14 @@ function runTest()
|
||||||
|
|
||||||
function checkDialogFocus(event)
|
function checkDialogFocus(event)
|
||||||
{
|
{
|
||||||
|
info("checkDialogFocus()");
|
||||||
// if full keyboard access is not on, just skip the tests
|
// if full keyboard access is not on, just skip the tests
|
||||||
var match = false;
|
var match = false;
|
||||||
if (fullKeyboardAccess) {
|
if (fullKeyboardAccess) {
|
||||||
if (!(event.target instanceof Element))
|
if (!(event.target instanceof Element)) {
|
||||||
|
info("target not an Element");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (expectedFocus == "textbox-yes")
|
if (expectedFocus == "textbox-yes")
|
||||||
match = (win.document.activeElement == win.document.getElementById(expectedFocus).inputField);
|
match = (win.document.activeElement == win.document.getElementById(expectedFocus).inputField);
|
||||||
|
@ -67,11 +74,13 @@ function runTest()
|
||||||
match = (win.document.activeElement.dlgType == expectedFocus.substring(1));
|
match = (win.document.activeElement.dlgType == expectedFocus.substring(1));
|
||||||
else
|
else
|
||||||
match = (win.document.activeElement.id == expectedFocus);
|
match = (win.document.activeElement.id == expectedFocus);
|
||||||
|
info("match = " + match);
|
||||||
if (!match)
|
if (!match)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
match = (win.document.activeElement == win.document.documentElement);
|
match = (win.document.activeElement == win.document.documentElement);
|
||||||
|
info("match = " + match);
|
||||||
}
|
}
|
||||||
|
|
||||||
win.removeEventListener("focus", checkDialogFocus, true);
|
win.removeEventListener("focus", checkDialogFocus, true);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче