Bug 975696 - Split ArchiveReader and FileHandle implementation into separate dirs. r=bent f=baku

--HG--
rename : dom/file/ArchiveEvent.cpp => dom/archivereader/ArchiveEvent.cpp
rename : dom/file/ArchiveEvent.h => dom/archivereader/ArchiveEvent.h
rename : dom/file/ArchiveReader.cpp => dom/archivereader/ArchiveReader.cpp
rename : dom/file/ArchiveReader.h => dom/archivereader/ArchiveReader.h
rename : dom/file/ArchiveRequest.cpp => dom/archivereader/ArchiveRequest.cpp
rename : dom/file/ArchiveRequest.h => dom/archivereader/ArchiveRequest.h
rename : dom/file/ArchiveZipEvent.cpp => dom/archivereader/ArchiveZipEvent.cpp
rename : dom/file/ArchiveZipEvent.h => dom/archivereader/ArchiveZipEvent.h
rename : dom/file/ArchiveZipFile.cpp => dom/archivereader/ArchiveZipFile.cpp
rename : dom/file/ArchiveZipFile.h => dom/archivereader/ArchiveZipFile.h
rename : dom/file/test/test_archivereader.html => dom/archivereader/test/test_basic.html
rename : dom/file/test/test_archivereader_nonUnicode.html => dom/archivereader/test/test_nonUnicode.html
rename : dom/file/test/test_archivereader_zip_in_zip.html => dom/archivereader/test/test_zip_in_zip.html
rename : dom/file/test/test_bug_793311.html => dom/base/test/test_bug793311.html
rename : dom/file/AsyncHelper.cpp => dom/filehandle/AsyncHelper.cpp
rename : dom/file/AsyncHelper.h => dom/filehandle/AsyncHelper.h
rename : dom/file/File.cpp => dom/filehandle/File.cpp
rename : dom/file/File.h => dom/filehandle/File.h
rename : dom/file/FileHandle.cpp => dom/filehandle/FileHandle.cpp
rename : dom/file/FileHandle.h => dom/filehandle/FileHandle.h
rename : dom/file/FileHelper.cpp => dom/filehandle/FileHelper.cpp
rename : dom/file/FileHelper.h => dom/filehandle/FileHelper.h
rename : dom/file/FileRequest.cpp => dom/filehandle/FileRequest.cpp
rename : dom/file/FileRequest.h => dom/filehandle/FileRequest.h
rename : dom/file/FileService.cpp => dom/filehandle/FileService.cpp
rename : dom/file/FileService.h => dom/filehandle/FileService.h
rename : dom/file/FileStreamWrappers.cpp => dom/filehandle/FileStreamWrappers.cpp
rename : dom/file/FileStreamWrappers.h => dom/filehandle/FileStreamWrappers.h
rename : dom/file/LockedFile.cpp => dom/filehandle/LockedFile.cpp
rename : dom/file/LockedFile.h => dom/filehandle/LockedFile.h
rename : dom/file/MemoryStreams.cpp => dom/filehandle/MemoryStreams.cpp
rename : dom/file/MemoryStreams.h => dom/filehandle/MemoryStreams.h
rename : dom/file/MetadataHelper.cpp => dom/filehandle/MetadataHelper.cpp
rename : dom/file/MetadataHelper.h => dom/filehandle/MetadataHelper.h
rename : dom/file/moz.build => dom/filehandle/moz.build
rename : dom/file/nsIFileStorage.h => dom/filehandle/nsIFileStorage.h
rename : dom/file/test/dummy_worker.js => dom/filehandle/test/dummy_worker.js
rename : dom/file/test/helpers.js => dom/filehandle/test/helpers.js
rename : dom/file/test/mochitest.ini => dom/filehandle/test/mochitest.ini
rename : dom/file/test/moz.build => dom/filehandle/test/moz.build
rename : dom/file/test/test_append_read_data.html => dom/filehandle/test/test_append_read_data.html
rename : dom/file/test/test_getFile.html => dom/filehandle/test/test_getFile.html
rename : dom/file/test/test_getFileId.html => dom/filehandle/test/test_getFileId.html
rename : dom/file/test/test_location.html => dom/filehandle/test/test_location.html
rename : dom/file/test/test_lockedfile_lifetimes.html => dom/filehandle/test/test_lockedfile_lifetimes.html
rename : dom/file/test/test_lockedfile_lifetimes_nested.html => dom/filehandle/test/test_lockedfile_lifetimes_nested.html
rename : dom/file/test/test_lockedfile_ordering.html => dom/filehandle/test/test_lockedfile_ordering.html
rename : dom/file/test/test_overlapping_lockedfiles.html => dom/filehandle/test/test_overlapping_lockedfiles.html
rename : dom/file/test/test_progress_events.html => dom/filehandle/test/test_progress_events.html
rename : dom/file/test/test_readonly_lockedfiles.html => dom/filehandle/test/test_readonly_lockedfiles.html
rename : dom/file/test/test_request_readyState.html => dom/filehandle/test/test_request_readyState.html
rename : dom/file/test/test_stream_tracking.html => dom/filehandle/test/test_stream_tracking.html
rename : dom/file/test/test_success_events_after_abort.html => dom/filehandle/test/test_success_events_after_abort.html
rename : dom/file/test/test_truncate.html => dom/filehandle/test/test_truncate.html
rename : dom/file/test/test_workers.html => dom/filehandle/test/test_workers.html
rename : dom/file/test/test_write_read_data.html => dom/filehandle/test/test_write_read_data.html
This commit is contained in:
Jan Varga 2014-05-07 16:32:12 +02:00
Родитель 0ccb9873c3
Коммит 6c4d8f4644
70 изменённых файлов: 517 добавлений и 320 удалений

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

@ -9,7 +9,7 @@
#include "nsCExternalHandlerService.h"
#include "nsProxyRelease.h"
USING_FILE_NAMESPACE
USING_ARCHIVEREADER_NAMESPACE
NS_IMPL_ISUPPORTS0(ArchiveItem)

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

@ -4,8 +4,8 @@
* 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_domarchiveevent_h__
#define mozilla_dom_file_domarchiveevent_h__
#ifndef mozilla_dom_archivereader_domarchiveevent_h__
#define mozilla_dom_archivereader_domarchiveevent_h__
#include "ArchiveReader.h"
@ -13,9 +13,9 @@
#include "nsIMIMEService.h"
#include "nsDOMFile.h"
#include "FileCommon.h"
#include "ArchiveReaderCommon.h"
BEGIN_FILE_NAMESPACE
BEGIN_ARCHIVEREADER_NAMESPACE
/**
* This class contains all the info needed for a single item
@ -76,7 +76,6 @@ protected: // data
nsresult mStatus;
};
END_FILE_NAMESPACE
#endif // mozilla_dom_file_domarchiveevent_h__
END_ARCHIVEREADER_NAMESPACE
#endif // mozilla_dom_archivereader_domarchiveevent_h__

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

@ -19,7 +19,7 @@
using namespace mozilla;
using namespace mozilla::dom;
USING_FILE_NAMESPACE
USING_ARCHIVEREADER_NAMESPACE
/* static */ already_AddRefed<ArchiveReader>
ArchiveReader::Constructor(const GlobalObject& aGlobal,

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

@ -4,12 +4,12 @@
* 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_domarchivereader_h__
#define mozilla_dom_file_domarchivereader_h__
#ifndef mozilla_dom_archivereader_domarchivereader_h__
#define mozilla_dom_archivereader_domarchivereader_h__
#include "nsWrapperCache.h"
#include "FileCommon.h"
#include "ArchiveReaderCommon.h"
#include "nsCOMArray.h"
#include "nsIChannel.h"
@ -23,7 +23,7 @@ class GlobalObject;
} // namespace dom
} // namespace mozilla
BEGIN_FILE_NAMESPACE
BEGIN_ARCHIVEREADER_NAMESPACE
class ArchiveRequest;
@ -107,6 +107,6 @@ protected:
nsCString mEncoding;
};
END_FILE_NAMESPACE
END_ARCHIVEREADER_NAMESPACE
#endif // mozilla_dom_file_domarchivereader_h__
#endif // mozilla_dom_archivereader_domarchivereader_h__

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

@ -4,8 +4,8 @@
* 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_filecommon_h__
#define mozilla_dom_file_filecommon_h__
#ifndef mozilla_dom_archivereader_archivereader_h
#define mozilla_dom_archivereader_archivereader_h
#include "mozilla/DOMEventTargetHelper.h"
#include "nsAutoPtr.h"
@ -15,11 +15,11 @@
#include "nsString.h"
#include "nsTArray.h"
#define BEGIN_FILE_NAMESPACE \
namespace mozilla { namespace dom { namespace file {
#define END_FILE_NAMESPACE \
} /* namespace file */ } /* namespace dom */ } /* namespace mozilla */
#define USING_FILE_NAMESPACE \
using namespace mozilla::dom::file;
#define BEGIN_ARCHIVEREADER_NAMESPACE \
namespace mozilla { namespace dom { namespace archivereader {
#define END_ARCHIVEREADER_NAMESPACE \
} /* namespace archivereader */ } /* namespace dom */ } /* namespace mozilla */
#define USING_ARCHIVEREADER_NAMESPACE \
using namespace mozilla::dom::archivereader;
#endif // mozilla_dom_file_filecommon_h__
#endif // mozilla_dom_archivereader_archivereadercommon_h

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

@ -13,7 +13,7 @@
using namespace mozilla;
USING_FILE_NAMESPACE
USING_ARCHIVEREADER_NAMESPACE
/**
* Class used to make asynchronous the ArchiveRequest.

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

@ -4,20 +4,20 @@
* 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_domarchiverequest_h__
#define mozilla_dom_file_domarchiverequest_h__
#ifndef mozilla_dom_archivereader_domarchiverequest_h__
#define mozilla_dom_archivereader_domarchiverequest_h__
#include "mozilla/Attributes.h"
#include "ArchiveReader.h"
#include "DOMRequest.h"
#include "FileCommon.h"
#include "ArchiveReaderCommon.h"
namespace mozilla {
class EventChainPreVisitor;
} // namespace mozilla
BEGIN_FILE_NAMESPACE
BEGIN_ARCHIVEREADER_NAMESPACE
/**
* This is the ArchiveRequest that handles any operation
@ -84,6 +84,6 @@ protected:
nsString mFilename;
};
END_FILE_NAMESPACE
END_ARCHIVEREADER_NAMESPACE
#endif // mozilla_dom_file_domarchiverequest_h__
#endif // mozilla_dom_archivereader_domarchiverequest_h__

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

@ -12,7 +12,7 @@
using namespace mozilla::dom;
USING_FILE_NAMESPACE
USING_ARCHIVEREADER_NAMESPACE
#ifndef PATH_MAX
# define PATH_MAX 65536 // The filename length is stored in 2 bytes

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

@ -4,16 +4,16 @@
* 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_domarchivezipevent_h__
#define mozilla_dom_file_domarchivezipevent_h__
#ifndef mozilla_dom_archivereader_domarchivezipevent_h__
#define mozilla_dom_archivereader_domarchivezipevent_h__
#include "mozilla/Attributes.h"
#include "ArchiveEvent.h"
#include "FileCommon.h"
#include "ArchiveReaderCommon.h"
#include "zipstruct.h"
BEGIN_FILE_NAMESPACE
BEGIN_ARCHIVEREADER_NAMESPACE
/**
* ArchiveZipItem - ArchiveItem for ArchiveReaderZipEvent
@ -62,7 +62,6 @@ private:
nsCString mEncoding;
};
END_FILE_NAMESPACE
#endif // mozilla_dom_file_domarchivezipevent_h__
END_ARCHIVEREADER_NAMESPACE
#endif // mozilla_dom_archivereader_domarchivezipevent_h__

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

@ -11,7 +11,7 @@
#include "zlib.h"
#include "mozilla/Attributes.h"
USING_FILE_NAMESPACE
USING_ARCHIVEREADER_NAMESPACE
#define ZIP_CHUNK 16384

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

@ -4,18 +4,18 @@
* 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_domarchivefile_h__
#define mozilla_dom_file_domarchivefile_h__
#ifndef mozilla_dom_archivereader_domarchivefile_h__
#define mozilla_dom_archivereader_domarchivefile_h__
#include "mozilla/Attributes.h"
#include "nsDOMFile.h"
#include "ArchiveReader.h"
#include "FileCommon.h"
#include "ArchiveReaderCommon.h"
#include "zipstruct.h"
BEGIN_FILE_NAMESPACE
BEGIN_ARCHIVEREADER_NAMESPACE
/**
* ZipFile to DOMFileCC
@ -75,6 +75,6 @@ private: // Data
nsString mFilename;
};
END_FILE_NAMESPACE
END_ARCHIVEREADER_NAMESPACE
#endif // mozilla_dom_file_domarchivefile_h__
#endif // mozilla_dom_archivereader_domarchivefile_h__

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

@ -0,0 +1,32 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
TEST_DIRS += ['test']
EXPORTS.mozilla.dom.archivereader += [
'ArchiveEvent.h',
'ArchiveReader.h',
'ArchiveReaderCommon.h',
'ArchiveRequest.h',
'ArchiveZipEvent.h',
'ArchiveZipFile.h',
]
UNIFIED_SOURCES += [
'ArchiveEvent.cpp',
'ArchiveReader.cpp',
'ArchiveRequest.cpp',
'ArchiveZipEvent.cpp',
'ArchiveZipFile.cpp',
]
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
'../base',
]
FINAL_LIBRARY = 'gklayout'

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

@ -0,0 +1,37 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var archiveReaderEnabled = false;
var testGenerator = testSteps();
function runTest()
{
enableArchiveReader();
SimpleTest.waitForExplicitFinish();
testGenerator.next();
}
function finishTest()
{
resetArchiveReader();
SimpleTest.executeSoon(function() {
testGenerator.close();
SimpleTest.finish();
});
}
function enableArchiveReader()
{
archiveReaderEnabled = SpecialPowers.getBoolPref("dom.archivereader.enabled");
SpecialPowers.setBoolPref("dom.archivereader.enabled", true);
}
function resetArchiveReader()
{
SpecialPowers.setBoolPref("dom.archivereader.enabled", archiveReaderEnabled);
}

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

@ -0,0 +1,11 @@
[DEFAULT]
skip-if = e10s
support-files =
helpers.js
[test_basic.html]
skip-if = (buildapp == 'b2g' && toolkit == 'gonk')
[test_nonUnicode.html]
skip-if = (buildapp == 'b2g' && toolkit == 'gonk')
[test_zip_in_zip.html]
skip-if = (buildapp == 'b2g' && toolkit == 'gonk')

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

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

@ -64,7 +64,7 @@
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/file/FileHandle.h"
#include "mozilla/dom/FileHandle.h"
#include "mozilla/dom/FileHandleBinding.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/IDBFactoryBinding.h"
@ -3243,7 +3243,7 @@ nsDOMWindowUtils::GetFileId(JS::Handle<JS::Value> aFile, JSContext* aCx,
if (!aFile.isPrimitive()) {
JSObject* obj = aFile.toObjectOrNull();
file::FileHandle* fileHandle;
FileHandle* fileHandle;
if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, obj, fileHandle))) {
*aResult = fileHandle->GetFileId();
return NS_OK;

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

@ -11,6 +11,7 @@ support-files =
[test_appname_override.html]
[test_audioWindowUtils.html]
[test_audioNotification.html]
[test_bug793311.html]
[test_bug913761.html]
[test_bug978522.html]
[test_bug979109.html]

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

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=793311
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 793311</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug {793311} **/
SimpleTest.waitForExplicitFinish();
try {
SpecialPowers.DOMWindowUtils.wrapDOMFile(null);
ok(false, "wrapDOMFile(null) throws an exception");
} catch(e) {
ok(true, "wrapDOMFile(null) throws an exception");
}
SimpleTest.finish();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=793311">Mozilla Bug 793311</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

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

@ -98,11 +98,11 @@ DOMInterfaces = {
},
'ArchiveReader': {
'nativeType': 'mozilla::dom::file::ArchiveReader',
'nativeType': 'mozilla::dom::archivereader::ArchiveReader',
},
'ArchiveRequest': {
'nativeType': 'mozilla::dom::file::ArchiveRequest',
'nativeType': 'mozilla::dom::archivereader::ArchiveRequest',
},
'AudioChannelManager': {
@ -437,7 +437,7 @@ DOMInterfaces = {
},
'FileHandle': {
'nativeType': 'mozilla::dom::file::FileHandle'
'nativeType': 'mozilla::dom::FileHandle'
},
'FileList': {
@ -457,7 +457,7 @@ DOMInterfaces = {
},
'FileRequest': {
'nativeType': 'mozilla::dom::file::FileRequest',
'nativeType': 'mozilla::dom::FileRequest',
},
'FormData': [
@ -725,7 +725,7 @@ DOMInterfaces = {
},
'LockedFile': {
'nativeType': 'mozilla::dom::file::LockedFile',
'nativeType': 'mozilla::dom::LockedFile',
},
'MediaList': {

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

@ -1,28 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Bug 793311 Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
try {
SpecialPowers.DOMWindowUtils.wrapDOMFile(null);
ok(false, "wrapDOMFile(null) throws an exception");
} catch(e) {
ok(true, "wrapDOMFile(null) throws an exception");
}
SimpleTest.finish();
</script>
</body>
</html>

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

@ -6,13 +6,15 @@
#include "AsyncHelper.h"
#include "FileService.h"
#include "MainThreadUtils.h"
#include "nsDebug.h"
#include "nsIEventTarget.h"
#include "nsIRequestObserver.h"
#include "nsNetUtil.h"
#include "FileService.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
NS_IMPL_ISUPPORTS(AsyncHelper, nsIRunnable, nsIRequest)
@ -124,3 +126,6 @@ AsyncHelper::SetLoadFlags(nsLoadFlags aLoadFlags)
NS_WARNING("Shouldn't be called!");
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace dom
} // namespace mozilla

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

@ -4,17 +4,17 @@
* 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_asynchelper_h__
#define mozilla_dom_file_asynchelper_h__
#include "FileCommon.h"
#ifndef mozilla_dom_AsyncHelper_h
#define mozilla_dom_AsyncHelper_h
#include "nsCOMPtr.h"
#include "nsIRequest.h"
#include "nsIRunnable.h"
class nsIRequestObserver;
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
/**
* Must be subclassed. The subclass must implement DoStreamWork.
@ -51,6 +51,7 @@ private:
nsresult mStatus;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_asynchelper_h__
#endif // mozilla_dom_AsyncHelper_h

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

@ -7,9 +7,37 @@
#include "File.h"
#include "LockedFile.h"
#include "mozilla/Assertions.h"
#include "nsDebug.h"
USING_FILE_NAMESPACE
using mozilla::dom::indexedDB::IndexedDatabaseManager;
namespace mozilla {
namespace dom {
using indexedDB::IndexedDatabaseManager;
// Create as a file
File::File(const nsAString& aName, const nsAString& aContentType,
uint64_t aLength, nsIFile* aFile, LockedFile* aLockedFile)
: nsDOMFileCC(aName, aContentType, aLength),
mFile(aFile), mLockedFile(aLockedFile),
mWholeFile(true), mStoredFile(false)
{
MOZ_ASSERT(mFile, "Null file!");
MOZ_ASSERT(mLockedFile, "Null locked file!");
}
// Create as a stored file
File::File(const nsAString& aName, const nsAString& aContentType,
uint64_t aLength, nsIFile* aFile, LockedFile* aLockedFile,
FileInfo* aFileInfo)
: nsDOMFileCC(aName, aContentType, aLength),
mFile(aFile), mLockedFile(aLockedFile),
mWholeFile(true), mStoredFile(true)
{
MOZ_ASSERT(mFile, "Null file!");
MOZ_ASSERT(mLockedFile, "Null locked file!");
mFileInfos.AppendElement(aFileInfo);
}
// Create slice
File::File(const File* aOther, uint64_t aStart, uint64_t aLength,
@ -36,6 +64,10 @@ File::File(const File* aOther, uint64_t aStart, uint64_t aLength,
}
}
File::~File()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(File, nsDOMFileCC,
mLockedFile)
@ -76,3 +108,6 @@ File::GetMozFullPathInternal(nsAString &aFilename)
return mFile->GetPath(aFilename);
}
} // namespace dom
} // namespace mozilla

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

@ -4,17 +4,19 @@
* 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_file_h__
#define mozilla_dom_file_file_h__
#ifndef mozilla_dom_File_h
#define mozilla_dom_File_h
#include "mozilla/Attributes.h"
#include "FileCommon.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsDOMFile.h"
#include "LockedFile.h"
namespace mozilla {
namespace dom {
BEGIN_FILE_NAMESPACE
class LockedFile;
class File : public nsDOMFileCC
{
@ -25,27 +27,12 @@ public:
// Create as a file
File(const nsAString& aName, const nsAString& aContentType,
uint64_t aLength, nsIFile* aFile, LockedFile* aLockedFile)
: nsDOMFileCC(aName, aContentType, aLength),
mFile(aFile), mLockedFile(aLockedFile),
mWholeFile(true), mStoredFile(false)
{
NS_ASSERTION(mFile, "Null file!");
NS_ASSERTION(mLockedFile, "Null locked file!");
}
uint64_t aLength, nsIFile* aFile, LockedFile* aLockedFile);
// Create as a stored file
File(const nsAString& aName, const nsAString& aContentType,
uint64_t aLength, nsIFile* aFile, LockedFile* aLockedFile,
FileInfo* aFileInfo)
: nsDOMFileCC(aName, aContentType, aLength),
mFile(aFile), mLockedFile(aLockedFile),
mWholeFile(true), mStoredFile(true)
{
NS_ASSERTION(mFile, "Null file!");
NS_ASSERTION(mLockedFile, "Null locked file!");
mFileInfos.AppendElement(aFileInfo);
}
FileInfo* aFileInfo);
// Overrides
NS_IMETHOD
@ -59,8 +46,7 @@ protected:
File(const File* aOther, uint64_t aStart, uint64_t aLength,
const nsAString& aContentType);
virtual ~File()
{ }
virtual ~File();
virtual already_AddRefed<nsIDOMBlob>
CreateSlice(uint64_t aStart, uint64_t aLength,
@ -92,6 +78,7 @@ private:
bool mStoredFile;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_file_h__
#endif // mozilla_dom_File_h

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

@ -6,23 +6,25 @@
#include "FileHandle.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsNetUtil.h"
#include "nsIDOMFile.h"
#include "nsIFileStorage.h"
#include "File.h"
#include "FileRequest.h"
#include "FileService.h"
#include "LockedFile.h"
#include "MetadataHelper.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/FileHandleBinding.h"
#include "mozilla/ErrorResult.h"
#include "nsAutoPtr.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIDOMFile.h"
#include "nsIFile.h"
#include "nsIFileStorage.h"
#include "nsNetUtil.h"
using namespace mozilla;
using namespace mozilla::dom;
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -55,6 +57,20 @@ private:
} // anonymous namespace
FileHandle::FileHandle(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow)
{
}
FileHandle::FileHandle(DOMEventTargetHelper* aOwner)
: DOMEventTargetHelper(aOwner)
{
}
FileHandle::~FileHandle()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileHandle, DOMEventTargetHelper,
mFileStorage)
@ -193,3 +209,6 @@ GetFileHelper::GetSuccessResult(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
return NS_OK;
}
} // namespace dom
} // namespace mozilla

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

@ -4,38 +4,38 @@
* 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_filehandle_h__
#define mozilla_dom_file_filehandle_h__
#include "FileCommon.h"
#include "nsIFile.h"
#include "nsIFileStorage.h"
#ifndef mozilla_dom_FileHandle_h
#define mozilla_dom_FileHandle_h
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/FileModeBinding.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsString.h"
class nsIDOMFile;
class nsIFile;
class nsIFileStorage;
class nsPIDOMWindow;
namespace mozilla {
class ErrorResult;
namespace dom {
class DOMRequest;
namespace indexedDB {
class FileInfo;
} // namespace indexedDB
} // namespace dom
} // namespace mozilla
BEGIN_FILE_NAMESPACE
class FileService;
class LockedFile;
class FinishHelper;
class FileHelper;
namespace indexedDB {
class FileInfo;
} // namespace indexedDB
/**
* This class provides a default FileHandle implementation, but it can be also
* subclassed. The subclass can override implementation of GetFileId,
@ -51,6 +51,7 @@ class FileHandle : public DOMEventTargetHelper
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileHandle, DOMEventTargetHelper)
static already_AddRefed<FileHandle>
@ -121,19 +122,11 @@ public:
IMPL_EVENT_HANDLER(error)
protected:
FileHandle(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow)
{
}
FileHandle(nsPIDOMWindow* aWindow);
FileHandle(DOMEventTargetHelper* aOwner)
: DOMEventTargetHelper(aOwner)
{
}
FileHandle(DOMEventTargetHelper* aOwner);
~FileHandle()
{
}
virtual ~FileHandle();
nsCOMPtr<nsIFileStorage> mFileStorage;
@ -144,6 +137,7 @@ protected:
nsString mFileName;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_filehandle_h__
#endif // mozilla_dom_FileHandle_h

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

@ -6,18 +6,19 @@
#include "FileHelper.h"
#include "nsIFileStorage.h"
#include "nsError.h"
#include "nsProxyRelease.h"
#include "FileHandle.h"
#include "FileRequest.h"
#include "FileService.h"
#include "js/Value.h"
#include "LockedFile.h"
#include "MainThreadUtils.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIFileStorage.h"
#include "nsIRequest.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -229,3 +230,6 @@ FileHelper::OnStreamDestroy()
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
} // namespace dom
} // namespace mozilla

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

@ -4,16 +4,18 @@
* 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_filehelper_h__
#define mozilla_dom_file_filehelper_h__
#include "FileCommon.h"
#ifndef mozilla_dom_FileHelper_h
#define mozilla_dom_FileHelper_h
#include "js/TypeDecls.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsIRequestObserver.h"
class nsIFileStorage;
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
class FileHelper;
class FileRequest;
@ -94,6 +96,7 @@ private:
bool mFinished;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_filehelper_h__
#endif // mozilla_dom_FileHelper_h

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

@ -6,18 +6,24 @@
#include "FileRequest.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/FileRequestBinding.h"
#include "nsCxPusher.h"
#include "nsError.h"
#include "nsIDOMProgressEvent.h"
#include "nsDOMClassInfoID.h"
#include "FileHelper.h"
#include "js/RootingAPI.h"
#include "jsapi.h"
#include "LockedFile.h"
#include "MainThreadUtils.h"
#include "mozilla/dom/FileRequestBinding.h"
#include "mozilla/EventDispatcher.h"
#include "nsCOMPtr.h"
#include "nsCxPusher.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIDOMEvent.h"
#include "nsIDOMProgressEvent.h"
#include "nsIScriptContext.h"
#include "nsLiteralString.h"
using namespace mozilla;
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
FileRequest::FileRequest(nsPIDOMWindow* aWindow)
: DOMRequest(aWindow), mWrapAsDOMRequest(false)
@ -146,3 +152,6 @@ FileRequest::FireProgressEvent(uint64_t aLoaded, uint64_t aTotal)
DispatchTrustedEvent(event);
}
} // namespace dom
} // namespace mozilla

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

@ -4,27 +4,31 @@
* 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_filerequest_h__
#define mozilla_dom_file_filerequest_h__
#include "mozilla/Attributes.h"
#include "FileCommon.h"
#ifndef mozilla_dom_FileRequest_h
#define mozilla_dom_FileRequest_h
#include "DOMRequest.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "nsAutoPtr.h"
#include "nsCycleCollectionParticipant.h"
class nsPIDOMWindow;
namespace mozilla {
class EventChainPreVisitor;
} // namespace mozilla
BEGIN_FILE_NAMESPACE
class EventChainPreVisitor;
namespace dom {
class FileHelper;
class LockedFile;
class FileRequest : public mozilla::dom::DOMRequest
class FileRequest : public DOMRequest
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
static already_AddRefed<FileRequest>
@ -66,6 +70,7 @@ protected:
bool mWrapAsDOMRequest;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_filerequest_h__
#endif // mozilla_dom_FileRequest_h

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

@ -6,17 +6,19 @@
#include "FileService.h"
#include "nsIFile.h"
#include "FileHandle.h"
#include "LockedFile.h"
#include "MainThreadUtils.h"
#include "nsError.h"
#include "nsIEventTarget.h"
#include "nsIFileStorage.h"
#include "nsIObserverService.h"
#include "nsIStreamTransportService.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "FileHandle.h"
#include "FileRequest.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -395,6 +397,14 @@ FileService::LockedFileQueue::ProcessQueue()
return NS_OK;
}
FileService::DelayedEnqueueInfo::DelayedEnqueueInfo()
{
}
FileService::DelayedEnqueueInfo::~DelayedEnqueueInfo()
{
}
FileService::LockedFileQueue*
FileService::FileStorageInfo::CreateLockedFileQueue(LockedFile* aLockedFile)
{
@ -520,3 +530,6 @@ FileService::FileStorageInfo::CollectRunningAndDelayedLockedFiles(
}
}
}
} // namespace dom
} // namespace mozilla

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

@ -4,20 +4,29 @@
* 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_fileservice_h__
#define mozilla_dom_file_fileservice_h__
#ifndef mozilla_dom_FileService_h
#define mozilla_dom_FileService_h
#include "FileCommon.h"
#include "nsIObserver.h"
#include "nsClassHashtable.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/FileHelper.h"
#include "nsClassHashtable.h"
#include "nsIObserver.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "mozilla/dom/file/FileHelper.h"
#include "mozilla/dom/file/LockedFile.h"
class nsAString;
class nsIEventTarget;
class nsIFileStorage;
class nsIRunnable;
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
class LockedFile;
class FileService MOZ_FINAL : public nsIObserver
{
@ -97,6 +106,9 @@ private:
struct DelayedEnqueueInfo
{
DelayedEnqueueInfo();
~DelayedEnqueueInfo();
nsRefPtr<LockedFile> mLockedFile;
nsRefPtr<FileHelper> mFileHelper;
};
@ -190,6 +202,7 @@ private:
nsTArray<StoragesCompleteCallback> mCompleteCallbacks;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_file_fileservice_h__ */
#endif // mozilla_dom_FileService_h

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

@ -6,13 +6,18 @@
#include "FileStreamWrappers.h"
#include "nsIFileStorage.h"
#include "nsISeekableStream.h"
#include "mozilla/Attributes.h"
#include "FileHelper.h"
#include "MainThreadUtils.h"
#include "mozilla/Attributes.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIFileStorage.h"
#include "nsIRunnable.h"
#include "nsISeekableStream.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -385,3 +390,6 @@ DestroyRunnable::Run()
return NS_OK;
}
} // namespace dom
} // namespace mozilla

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

@ -4,15 +4,16 @@
* 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_filestreamwrappers_h__
#define mozilla_dom_file_filestreamwrappers_h__
#include "FileCommon.h"
#ifndef mozilla_dom_FileStreamWrappers_h
#define mozilla_dom_FileStreamWrappers_h
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
class FileHelper;
@ -73,10 +74,10 @@ public:
NS_DECL_NSIOUTPUTSTREAM
FileOutputStreamWrapper(nsISupports* aFileStream,
FileHelper* aFileHelper,
uint64_t aOffset,
uint64_t aLimit,
uint32_t aFlags);
FileHelper* aFileHelper,
uint64_t aOffset,
uint64_t aLimit,
uint32_t aFlags);
protected:
virtual ~FileOutputStreamWrapper()
@ -89,6 +90,7 @@ private:
#endif
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_filestreamwrappers_h__
#endif // mozilla_dom_FileStreamWrappers_h

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

@ -14,26 +14,29 @@
#include "FileStreamWrappers.h"
#include "MemoryStreams.h"
#include "MetadataHelper.h"
#include "mozilla/dom/DOMRequest.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/dom/LockedFileBinding.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/EventDispatcher.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIAppShell.h"
#include "nsIDOMEvent.h"
#include "nsIDOMFile.h"
#include "nsIEventTarget.h"
#include "nsIFileStorage.h"
#include "nsISeekableStream.h"
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsStringStream.h"
#include "nsThreadUtils.h"
#include "nsWidgetsCID.h"
#define STREAM_COPY_BLOCK_SIZE 32768
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -147,7 +150,7 @@ class FlushHelper : public FileHelper
{
public:
FlushHelper(LockedFile* aLockedFile,
FileRequest* aFileRequest)
FileRequest* aFileRequest)
: FileHelper(aLockedFile, aFileRequest)
{ }
@ -196,7 +199,7 @@ private:
};
already_AddRefed<nsIDOMEvent>
CreateGenericEvent(mozilla::dom::EventTarget* aEventOwner,
CreateGenericEvent(EventTarget* aEventOwner,
const nsAString& aType, bool aBubbles, bool aCancelable)
{
nsCOMPtr<nsIDOMEvent> event;
@ -1058,4 +1061,5 @@ OpenStreamHelper::DoAsyncRun(nsISupports* aStream)
return NS_OK;
}
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla

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

@ -4,40 +4,50 @@
* 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_lockedfile_h__
#define mozilla_dom_file_lockedfile_h__
#ifndef mozilla_dom_LockedFile_h
#define mozilla_dom_LockedFile_h
#include "FileCommon.h"
#include "js/TypeDecls.h"
#include "MainThreadUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FileModeBinding.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/ErrorResult.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIInputStream.h"
#include "nsIRunnable.h"
#include "nsTArray.h"
class nsAString;
class nsIDOMBlob;
class nsPIDOMWindow;
namespace mozilla {
namespace dom {
class DOMFileMetadataParameters;
class DOMRequest;
} // namespace dom
} // namespace mozilla
namespace mozilla {
class EventChainPreVisitor;
} // namespace mozilla
BEGIN_FILE_NAMESPACE
namespace dom {
class DOMFileMetadataParameters;
class FileHandle;
class FileHelper;
class FileRequest;
class FileService;
class FinishHelper;
class MetadataHelper;
class LockedFile : public DOMEventTargetHelper,
public nsIRunnable
{
friend class FinishHelper;
friend class FileService;
friend class FileHelper;
friend class FileService;
friend class FinishHelper;
friend class MetadataHelper;
public:
@ -303,6 +313,7 @@ private:
bool mAborted;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_lockedfile_h__
#endif // mozilla_dom_LockedFile_h

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

@ -6,9 +6,14 @@
#include "MemoryStreams.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsStreamUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
// static
already_AddRefed<MemoryOutputStream>
@ -88,3 +93,6 @@ MemoryOutputStream::IsNonBlocking(bool* _retval)
*_retval = false;
return NS_OK;
}
} // namespace dom
} // namespace mozilla

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

@ -4,14 +4,16 @@
* 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_memorystreams_h__
#define mozilla_dom_file_memorystreams_h__
#include "FileCommon.h"
#ifndef mozilla_dom_MemoryStreams_h
#define mozilla_dom_MemoryStreams_h
#include "nsIOutputStream.h"
#include "nsString.h"
BEGIN_FILE_NAMESPACE
template <class> class already_AddRefed;
namespace mozilla {
namespace dom {
class MemoryOutputStream : public nsIOutputStream
{
@ -22,7 +24,6 @@ public:
static already_AddRefed<MemoryOutputStream>
Create(uint64_t aSize);
const nsCString&
Data() const
{
@ -41,6 +42,7 @@ private:
uint64_t mOffset;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_memorystreams_h__
#endif // mozilla_dom_MemoryStreams_h

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

@ -6,9 +6,17 @@
#include "MetadataHelper.h"
#include "js/Value.h"
#include "js/RootingAPI.h"
#include "jsapi.h"
#include "LockedFile.h"
#include "mozilla/dom/FileModeBinding.h"
#include "nsDebug.h"
#include "nsIFileStreams.h"
#include "nsIOutputStream.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
nsresult
MetadataHelper::DoAsyncRun(nsISupports* aStream)
@ -94,3 +102,6 @@ MetadataHelper::AsyncMetadataGetter::DoStreamWork(nsISupports* aStream)
return NS_OK;
}
} // namespace dom
} // namespace mozilla

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

@ -4,20 +4,17 @@
* 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_metadatahelper_h__
#define mozilla_dom_file_metadatahelper_h__
#include "mozilla/Attributes.h"
#include "FileCommon.h"
#include "nsIFileStreams.h"
#ifndef mozilla_dom_MetadataHelper_h
#define mozilla_dom_MetadataHelper_h
#include "AsyncHelper.h"
#include "FileHelper.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "nsAutoPtr.h"
class nsIFileStream;
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
class MetadataHelper;
@ -115,6 +112,7 @@ protected:
nsRefPtr<MetadataParameters> mParams;
};
END_FILE_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_file_metadatahelper_h__
#endif // mozilla_dom_MetadataHelper_h

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

@ -10,14 +10,8 @@ EXPORTS += [
'nsIFileStorage.h',
]
EXPORTS.mozilla.dom.file += [
'ArchiveEvent.h',
'ArchiveReader.h',
'ArchiveRequest.h',
'ArchiveZipEvent.h',
'ArchiveZipFile.h',
EXPORTS.mozilla.dom += [
'File.h',
'FileCommon.h',
'FileHandle.h',
'FileHelper.h',
'FileRequest.h',
@ -26,11 +20,6 @@ EXPORTS.mozilla.dom.file += [
]
UNIFIED_SOURCES += [
'ArchiveEvent.cpp',
'ArchiveReader.cpp',
'ArchiveRequest.cpp',
'ArchiveZipEvent.cpp',
'ArchiveZipFile.cpp',
'AsyncHelper.cpp',
'File.cpp',
'FileHandle.cpp',

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

@ -13,6 +13,8 @@
{0x6278f453, 0xd557, 0x4a55, \
{ 0x99, 0x3e, 0xf4, 0x69, 0xe2, 0xa5, 0xe1, 0xd0 } }
class nsACString;
class nsIFileStorage : public nsISupports
{
public:

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

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

@ -13,14 +13,11 @@ var fileStorages = [
var utils = SpecialPowers.getDOMWindowUtils(window);
var archiveReaderEnabled = false;
var testGenerator = testSteps();
function runTest()
{
allowUnlimitedQuota();
enableArchiveReader();
SimpleTest.waitForExplicitFinish();
testGenerator.next();
@ -29,7 +26,6 @@ function runTest()
function finishTest()
{
resetUnlimitedQuota();
resetArchiveReader();
SimpleTest.executeSoon(function() {
testGenerator.close();
@ -102,17 +98,6 @@ function resetUnlimitedQuota(url)
removePermission("indexedDB-unlimited", url);
}
function enableArchiveReader()
{
archiveReaderEnabled = SpecialPowers.getBoolPref("dom.archivereader.enabled");
SpecialPowers.setBoolPref("dom.archivereader.enabled", true);
}
function resetArchiveReader()
{
SpecialPowers.setBoolPref("dom.archivereader.enabled", archiveReaderEnabled);
}
function getFileHandle(fileStorageKey, name)
{
var requestService = SpecialPowers.getDOMRequestService();

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

@ -6,13 +6,6 @@ support-files =
[test_append_read_data.html]
skip-if = buildapp == 'b2g'
[test_archivereader.html]
skip-if = buildapp == 'b2g'
[test_archivereader_nonUnicode.html]
skip-if = buildapp == 'b2g'
[test_archivereader_zip_in_zip.html]
skip-if = buildapp == 'b2g'
[test_bug_793311.html]
[test_getFile.html]
skip-if = buildapp == 'b2g'
[test_getFileId.html]
@ -27,7 +20,7 @@ skip-if = buildapp == 'b2g'
[test_overlapping_lockedfiles.html]
skip-if = buildapp == 'b2g'
[test_progress_events.html]
skip-if = buildapp == 'b2g' # b2g(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:126) b2g-debug(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:126) b2g-desktop(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:126)
skip-if = buildapp == 'b2g' # b2g(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:109) b2g-debug(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:109) b2g-desktop(All of these fail fairly regularly with: UnknownError: The operation failed for reasons unrelated to the database itself and not covered by any other error code. at http://mochi.test:8888/tests/dom/file/test/helpers.js:109)
[test_readonly_lockedfiles.html]
skip-if = buildapp == 'b2g'
[test_request_readyState.html]

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

@ -0,0 +1,8 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
MOCHITEST_MANIFESTS += ['mochitest.ini']

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

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

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

@ -6,7 +6,7 @@
#include "IDBFileHandle.h"
#include "mozilla/dom/file/File.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/IDBFileHandleBinding.h"
#include "mozilla/dom/quota/FileStreams.h"
@ -97,11 +97,11 @@ IDBFileHandle::CreateStream(nsIFile* aFile, bool aReadOnly)
}
already_AddRefed<nsIDOMFile>
IDBFileHandle::CreateFileObject(mozilla::dom::file::LockedFile* aLockedFile,
IDBFileHandle::CreateFileObject(mozilla::dom::LockedFile* aLockedFile,
uint32_t aFileSize)
{
nsCOMPtr<nsIDOMFile> file = new mozilla::dom::file::File(
mName, mType, aFileSize, mFile, aLockedFile, mFileInfo);
nsCOMPtr<nsIDOMFile> file =
new File(mName, mType, aFileSize, mFile, aLockedFile, mFileInfo);
return file.forget();
}

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

@ -9,16 +9,16 @@
#include "IndexedDatabase.h"
#include "mozilla/dom/file/FileHandle.h"
#include "mozilla/dom/FileHandle.h"
#include "mozilla/dom/indexedDB/FileInfo.h"
BEGIN_INDEXEDDB_NAMESPACE
class IDBDatabase;
class IDBFileHandle : public file::FileHandle
class IDBFileHandle : public FileHandle
{
typedef mozilla::dom::file::LockedFile LockedFile;
typedef mozilla::dom::LockedFile LockedFile;
public:
static already_AddRefed<IDBFileHandle>

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

@ -1560,7 +1560,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx,
IDBTransaction* transaction = cloneWriteInfo->mTransaction;
FileManager* fileManager = transaction->Database()->Manager();
file::FileHandle* fileHandle = nullptr;
FileHandle* fileHandle = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aObj, fileHandle))) {
nsRefPtr<FileInfo> fileInfo = fileHandle->GetFileInfo();

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

@ -38,6 +38,7 @@ PARALLEL_DIRS += [
'apps',
'base',
'activities',
'archivereader',
'bindings',
'battery',
'bluetooth',
@ -49,7 +50,7 @@ PARALLEL_DIRS += [
'devicestorage',
'encoding',
'events',
'file',
'filehandle',
'filesystem',
'fmradio',
'asmjscache',

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

@ -21,13 +21,14 @@
#include "nsITimer.h"
#include "nsIURI.h"
#include "nsIUsageCallback.h"
#include "nsPIDOMWindow.h"
#include <algorithm>
#include "GeckoProfiler.h"
#include "mozilla/Atomics.h"
#include "mozilla/CondVar.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/file/FileService.h"
#include "mozilla/dom/FileService.h"
#include "mozilla/dom/indexedDB/Client.h"
#include "mozilla/Mutex.h"
#include "mozilla/LazyIdleThread.h"
@ -89,7 +90,7 @@
USING_QUOTA_NAMESPACE
using namespace mozilla::dom;
using mozilla::dom::file::FileService;
using mozilla::dom::FileService;
static_assert(
static_cast<uint32_t>(StorageType::Persistent) ==