This commit is contained in:
Wes Kocher 2014-05-07 17:41:06 -07:00
Родитель 8186ac9ac7 0e7578947c
Коммит b0cf98eb6e
150 изменённых файлов: 1592 добавлений и 1004 удалений

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

@ -17,6 +17,18 @@ var gIterator;
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import("resource://gre/modules/accessibility/Utils.jsm");
Components.utils.import("resource://gre/modules/accessibility/EventManager.jsm");
Components.utils.import("resource://gre/modules/accessibility/Gestures.jsm");
const dwellThreshold = GestureSettings.dwellThreshold;
const swipeMaxDuration = GestureSettings.swipeMaxDuration;
const maxConsecutiveGestureDelay = GestureSettings.maxConsecutiveGestureDelay;
// https://bugzilla.mozilla.org/show_bug.cgi?id=1001945 - sometimes
// SimpleTest.executeSoon timeout is bigger than the timer settings in
// GestureSettings that causes intermittents.
GestureSettings.dwellThreshold = dwellThreshold * 10;
GestureSettings.swipeMaxDuration = swipeMaxDuration * 10;
GestureSettings.maxConsecutiveGestureDelay = maxConsecutiveGestureDelay * 10;
var AccessFuTest = {
@ -98,6 +110,10 @@ var AccessFuTest = {
// Disable the console service logging.
Logger.test = false;
Logger.logLevel = Logger.INFO;
// Reset Gesture Settings.
GestureSettings.dwellThreshold = dwellThreshold;
GestureSettings.swipeMaxDuration = swipeMaxDuration;
GestureSettings.maxConsecutiveGestureDelay = maxConsecutiveGestureDelay;
// Finish through idle callback to let AccessFu._disable complete.
SimpleTest.executeSoon(function () {
AccessFu.detach();

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>

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

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>

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

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "787e0db2b536a3f1105c12819d48a8a584d5d4d6",
"revision": "e2fad48ac3a632fbd405ff958c9dbf0d821f7b47",
"repo_path": "/integration/gaia-central"
}

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="347d0517f0a77122c876d5f62c0942006a7a0bfe"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1e0574b8f6b8a2a8d9d468878ce2b4c283fc9a84"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -53,9 +53,9 @@ pref("extensions.blocklist.interval", 86400);
// Controls what level the blocklist switches from warning about items to forcibly
// blocking them.
pref("extensions.blocklist.level", 2);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.org/%LOCALE%/blocklist/");
pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");
pref("extensions.blocklist.itemURL", "https://blocklist.addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");
pref("extensions.update.autoUpdateDefault", true);

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

@ -237,7 +237,7 @@ pref("extensions.update.enabled", false);
/* blocklist preferences */
pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.org/%LOCALE%/blocklist/");
pref("extensions.showMismatchUI", false);

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

@ -707,9 +707,6 @@ clean clobber realclean clobber_all distclean::
else
clean clobber realclean clobber_all distclean::
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
distclean::
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
endif
distclean::

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

@ -10,6 +10,8 @@
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;
// Need to clarify why declare mediaRecorder in startTest cause timeout.;
var mediaRecorder;
/**
* Starts a test on every media recorder file included to check that a
@ -26,7 +28,7 @@ function startTest(test, token) {
element.test = test;
element.stream = element.mozCaptureStreamUntilEnded();
var mediaRecorder = new MediaRecorder(element.stream);
mediaRecorder = new MediaRecorder(element.stream);
var onStopFired = false;
var onDataAvailableFired = false;

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

@ -1,6 +1,6 @@
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<box onerror="document.loadOverlay('file:///does-not-exist', null);" >
<html:script src="ftp://mozilla.org"/>
<html:script src="ftp://some.website.that.will.cause.an.error"/>
</box>
</window>

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

@ -3466,11 +3466,14 @@ nsDocShell::IsSandboxedFrom(nsIDocShell* aTargetDocShell)
return false;
}
uint32_t sandboxFlags = 0;
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
sandboxFlags = doc->GetSandboxFlags();
// Default the sandbox flags to our flags, so that if we can't retrieve the
// active document, we will still enforce our own.
uint32_t sandboxFlags = mSandboxFlags;
if (mContentViewer) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
sandboxFlags = doc->GetSandboxFlags();
}
}
// If no flags, we are not sandboxed at all.

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

@ -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')

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

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

@ -1323,23 +1323,22 @@ AllocEntryParent(OpenMode aOpenMode,
WriteParams aWriteParams,
nsIPrincipal* aPrincipal)
{
ParentProcessRunnable* runnable =
nsRefPtr<ParentProcessRunnable> runnable =
new ParentProcessRunnable(aPrincipal, aOpenMode, aWriteParams);
// AddRef to keep the runnable alive until DeallocEntryParent.
runnable->AddRef();
nsresult rv = NS_DispatchToMainThread(runnable);
NS_ENSURE_SUCCESS(rv, nullptr);
return runnable;
// Transfer ownership to IPDL.
return runnable.forget().take();
}
void
DeallocEntryParent(PAsmJSCacheEntryParent* aActor)
{
// Match the AddRef in AllocEntryParent.
static_cast<ParentProcessRunnable*>(aActor)->Release();
// Transfer ownership back from IPDL.
nsRefPtr<ParentProcessRunnable> op =
dont_AddRef(static_cast<ParentProcessRunnable*>(aActor));
}
namespace {

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

@ -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"
@ -2725,8 +2725,8 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
driver->AdvanceTimeAndRefresh(aMilliseconds);
LayerTransactionChild* transaction = GetLayerTransaction();
if (transaction) {
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();
if (transaction && transaction->IPCOpen()) {
transaction->SendSetTestSampleTime(driver->MostRecentRefresh());
}
@ -2743,8 +2743,8 @@ nsDOMWindowUtils::RestoreNormalRefresh()
// Kick the compositor out of test mode before the refresh driver, so that
// the refresh driver doesn't send an update that gets ignored by the
// compositor.
LayerTransactionChild* transaction = GetLayerTransaction();
if (transaction) {
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();
if (transaction && transaction->IPCOpen()) {
transaction->SendLeaveTestMode();
}
@ -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': {

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

@ -1111,7 +1111,7 @@ public:
break;
}
}
MOZ_ASSERT_IF(i == properties.Length(), "failed to get device name");
MOZ_ASSERT(i != properties.Length(), "failed to get device name");
nsRefPtr<DistributeBluetoothSignalTask> task =
new DistributeBluetoothSignalTask(mSignal);

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

@ -38,10 +38,7 @@
function testBasicInterface() {
var cursor = gStore.sync();
ok(cursor, "Cursor is created");
// TODO This needs more love for running on workers. Tend to fire a
// follow-up for this...
// is(cursor.store, gStore, "Cursor.store is the store");
is(cursor.store, gStore, "Cursor.store is the store");
ok("next" in cursor, "Cursor.next exists");
ok("close" in cursor, "Cursor.close exists");

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

@ -1,57 +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 nsIFileStorage_h__
#define nsIFileStorage_h__
#include "nsISupports.h"
#define NS_FILESTORAGE_IID \
{0x6278f453, 0xd557, 0x4a55, \
{ 0x99, 0x3e, 0xf4, 0x69, 0xe2, 0xa5, 0xe1, 0xd0 } }
class nsIFileStorage : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FILESTORAGE_IID)
NS_IMETHOD_(const nsACString&)
Id() = 0;
// Whether or not the storage has been invalidated. If it has then no further
// operations for this storage will be allowed to run.
NS_IMETHOD_(bool)
IsInvalidated() = 0;
NS_IMETHOD_(bool)
IsShuttingDown() = 0;
NS_IMETHOD_(void)
SetThreadLocals() = 0;
NS_IMETHOD_(void)
UnsetThreadLocals() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFileStorage, NS_FILESTORAGE_IID)
#define NS_DECL_NSIFILESTORAGE \
NS_IMETHOD_(const nsACString&) \
Id() MOZ_OVERRIDE; \
\
NS_IMETHOD_(bool) \
IsInvalidated() MOZ_OVERRIDE; \
\
NS_IMETHOD_(bool) \
IsShuttingDown() MOZ_OVERRIDE; \
\
NS_IMETHOD_(void) \
SetThreadLocals() MOZ_OVERRIDE; \
\
NS_IMETHOD_(void) \
UnsetThreadLocals() MOZ_OVERRIDE;
#endif // nsIFileStorage_h__

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

@ -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,24 @@
#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 "nsNetUtil.h"
using namespace mozilla;
using namespace mozilla::dom;
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -55,35 +56,24 @@ private:
} // anonymous namespace
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileHandle, DOMEventTargetHelper,
mFileStorage)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileHandle)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(FileHandle, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(FileHandle, DOMEventTargetHelper)
// static
already_AddRefed<FileHandle>
FileHandle::Create(nsPIDOMWindow* aWindow,
nsIFileStorage* aFileStorage,
nsIFile* aFile)
FileHandle::FileHandle(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow)
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
}
nsRefPtr<FileHandle> newFileHandle = new FileHandle(aWindow);
FileHandle::FileHandle(DOMEventTargetHelper* aOwner)
: DOMEventTargetHelper(aOwner)
{
}
newFileHandle->mFileStorage = aFileStorage;
nsresult rv = aFile->GetLeafName(newFileHandle->mName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
FileHandle::~FileHandle()
{
}
newFileHandle->mFile = aFile;
newFileHandle->mFileName = newFileHandle->mName;
return newFileHandle.forget();
bool
FileHandle::IsShuttingDown()
{
return FileService::IsShuttingDown();
}
// virtual
@ -133,7 +123,7 @@ FileHandle::Open(FileMode aMode, ErrorResult& aError)
{
MOZ_ASSERT(NS_IsMainThread());
if (FileService::IsShuttingDown() || mFileStorage->IsShuttingDown()) {
if (IsShuttingDown()) {
aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
return nullptr;
}
@ -193,3 +183,6 @@ GetFileHelper::GetSuccessResult(JSContext* aCx,
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
return NS_OK;
}
} // namespace dom
} // namespace mozilla

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

@ -4,42 +4,42 @@
* 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 "nsString.h"
class nsIDOMFile;
class nsIFileStorage;
class nsIFile;
class nsIOfflineStorage;
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,
* GetFileInfo, CreateStream and CreateFileObject.
* GetFileInfo, IsShuttingDown, IsInvalid, CreateStream, SetThreadLocals,
* UnsetThreadLocals and CreateFileObject.
* (for example IDBFileHandle provides IndexedDB specific implementation).
*/
class FileHandle : public DOMEventTargetHelper
@ -50,14 +50,6 @@ class FileHandle : public DOMEventTargetHelper
friend class FileHelper;
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileHandle, DOMEventTargetHelper)
static already_AddRefed<FileHandle>
Create(nsPIDOMWindow* aWindow,
nsIFileStorage* aFileStorage,
nsIFile* aFile);
const nsAString&
Name() const
{
@ -82,9 +74,33 @@ public:
return nullptr;
}
virtual bool
IsShuttingDown();
virtual bool
IsInvalid()
{
return false;
}
// A temporary method that will be removed along with nsIOfflineStorage
// interface.
virtual nsIOfflineStorage*
Storage() = 0;
virtual already_AddRefed<nsISupports>
CreateStream(nsIFile* aFile, bool aReadOnly);
virtual void
SetThreadLocals()
{
}
virtual void
UnsetThreadLocals()
{
}
virtual already_AddRefed<nsIDOMFile>
CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize);
@ -121,29 +137,22 @@ public:
IMPL_EVENT_HANDLER(error)
protected:
FileHandle(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow)
{
}
FileHandle(nsPIDOMWindow* aWindow);
FileHandle(DOMEventTargetHelper* aOwner)
: DOMEventTargetHelper(aOwner)
{
}
FileHandle(DOMEventTargetHelper* aOwner);
~FileHandle()
{
}
nsCOMPtr<nsIFileStorage> mFileStorage;
virtual ~FileHandle();
nsString mName;
nsString mType;
nsCOMPtr<nsIFile> mFile;
nsCString mStorageId;
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 "mozilla/Assertions.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIRequest.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -27,7 +28,7 @@ LockedFile* gCurrentLockedFile = nullptr;
FileHelper::FileHelper(LockedFile* aLockedFile,
FileRequest* aFileRequest)
: mFileStorage(aLockedFile->mFileHandle->mFileStorage),
: mFileHandle(aLockedFile->mFileHandle),
mLockedFile(aLockedFile),
mFileRequest(aFileRequest),
mResultCode(NS_OK),
@ -38,8 +39,8 @@ FileHelper::FileHelper(LockedFile* aLockedFile,
FileHelper::~FileHelper()
{
NS_ASSERTION(!mFileStorage && !mLockedFile && !mFileRequest && !mListener &&
!mRequest, "Should have cleared this!");
MOZ_ASSERT(!mFileHandle && !mLockedFile && !mFileRequest && !mListener &&
!mRequest, "Should have cleared this!");
}
NS_IMPL_ISUPPORTS(FileHelper, nsIRequestObserver)
@ -168,7 +169,7 @@ FileHelper::ReleaseObjects()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mFileStorage = nullptr;
mFileHandle = nullptr;
mLockedFile = nullptr;
mFileRequest = nullptr;
mListener = nullptr;
@ -211,8 +212,8 @@ FileHelper::Finish()
ReleaseObjects();
NS_ASSERTION(!(mFileStorage || mLockedFile || mFileRequest || mListener ||
mRequest), "Subclass didn't call FileHelper::ReleaseObjects!");
MOZ_ASSERT(!(mFileHandle || mLockedFile || mFileRequest || mListener ||
mRequest), "Subclass didn't call FileHelper::ReleaseObjects!");
}
@ -229,3 +230,6 @@ FileHelper::OnStreamDestroy()
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Finish();
}
} // namespace dom
} // namespace mozilla

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

@ -4,18 +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_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 FileHandle;
class FileRequest;
class FileOutputStreamWrapper;
class LockedFile;
@ -82,7 +83,7 @@ protected:
void
Finish();
nsCOMPtr<nsIFileStorage> mFileStorage;
nsRefPtr<FileHandle> mFileHandle;
nsRefPtr<LockedFile> mLockedFile;
nsRefPtr<FileRequest> mFileRequest;
@ -94,6 +95,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,20 @@
#include "FileService.h"
#include "nsIFile.h"
#include "nsIFileStorage.h"
#include "nsIObserverService.h"
#include "nsIStreamTransportService.h"
#include "nsNetCID.h"
#include "FileHandle.h"
#include "FileRequest.h"
#include "LockedFile.h"
#include "MainThreadUtils.h"
#include "mozilla/Assertions.h"
#include "nsError.h"
#include "nsIEventTarget.h"
#include "nsIObserverService.h"
#include "nsIOfflineStorage.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -53,7 +56,7 @@ FileService::Cleanup()
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsIThread* thread = NS_GetCurrentThread();
while (mFileStorageInfos.Count()) {
while (mStorageInfos.Count()) {
if (!NS_ProcessNextEvent(thread)) {
NS_ERROR("Failed to process next event!");
break;
@ -150,64 +153,64 @@ FileService::Enqueue(LockedFile* aLockedFile, FileHelper* aFileHelper)
FileHandle* fileHandle = aLockedFile->mFileHandle;
if (fileHandle->mFileStorage->IsInvalidated()) {
if (fileHandle->IsInvalid()) {
return NS_ERROR_NOT_AVAILABLE;
}
const nsACString& storageId = fileHandle->mFileStorage->Id();
const nsACString& storageId = fileHandle->mStorageId;
const nsAString& fileName = fileHandle->mFileName;
bool modeIsWrite = aLockedFile->mMode == FileMode::Readwrite;
FileStorageInfo* fileStorageInfo;
if (!mFileStorageInfos.Get(storageId, &fileStorageInfo)) {
nsAutoPtr<FileStorageInfo> newFileStorageInfo(new FileStorageInfo());
StorageInfo* storageInfo;
if (!mStorageInfos.Get(storageId, &storageInfo)) {
nsAutoPtr<StorageInfo> newStorageInfo(new StorageInfo());
mFileStorageInfos.Put(storageId, newFileStorageInfo);
mStorageInfos.Put(storageId, newStorageInfo);
fileStorageInfo = newFileStorageInfo.forget();
storageInfo = newStorageInfo.forget();
}
LockedFileQueue* existingLockedFileQueue =
fileStorageInfo->GetLockedFileQueue(aLockedFile);
storageInfo->GetLockedFileQueue(aLockedFile);
if (existingLockedFileQueue) {
existingLockedFileQueue->Enqueue(aFileHelper);
return NS_OK;
}
bool lockedForReading = fileStorageInfo->IsFileLockedForReading(fileName);
bool lockedForWriting = fileStorageInfo->IsFileLockedForWriting(fileName);
bool lockedForReading = storageInfo->IsFileLockedForReading(fileName);
bool lockedForWriting = storageInfo->IsFileLockedForWriting(fileName);
if (modeIsWrite) {
if (!lockedForWriting) {
fileStorageInfo->LockFileForWriting(fileName);
storageInfo->LockFileForWriting(fileName);
}
}
else {
if (!lockedForReading) {
fileStorageInfo->LockFileForReading(fileName);
storageInfo->LockFileForReading(fileName);
}
}
if (lockedForWriting || (lockedForReading && modeIsWrite)) {
fileStorageInfo->CreateDelayedEnqueueInfo(aLockedFile, aFileHelper);
storageInfo->CreateDelayedEnqueueInfo(aLockedFile, aFileHelper);
}
else {
LockedFileQueue* lockedFileQueue =
fileStorageInfo->CreateLockedFileQueue(aLockedFile);
storageInfo->CreateLockedFileQueue(aLockedFile);
if (aFileHelper) {
// Enqueue() will queue the file helper if there's already something
// running. That can't fail, so no need to eventually remove
// fileStorageInfo from the hash table.
// storageInfo from the hash table.
//
// If the file helper is free to run then AsyncRun() is called on the
// file helper. AsyncRun() is responsible for calling all necessary
// callbacks when something fails. We're propagating the error here,
// however there's no need to eventually remove fileStorageInfo from
// however there's no need to eventually remove storageInfo from
// the hash table. Code behind AsyncRun() will take care of it. The last
// item in the code path is NotifyLockedFileCompleted() which removes
// fileStorageInfo from the hash table if there are no locked files for
// storageInfo from the hash table if there are no locked files for
// the file storage.
nsresult rv = lockedFileQueue->Enqueue(aFileHelper);
NS_ENSURE_SUCCESS(rv, rv);
@ -224,18 +227,18 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
NS_ASSERTION(aLockedFile, "Null pointer!");
FileHandle* fileHandle = aLockedFile->mFileHandle;
const nsACString& storageId = fileHandle->mFileStorage->Id();
const nsACString& storageId = fileHandle->mStorageId;
FileStorageInfo* fileStorageInfo;
if (!mFileStorageInfos.Get(storageId, &fileStorageInfo)) {
StorageInfo* storageInfo;
if (!mStorageInfos.Get(storageId, &storageInfo)) {
NS_ERROR("We don't know anyting about this locked file?!");
return;
}
fileStorageInfo->RemoveLockedFileQueue(aLockedFile);
storageInfo->RemoveLockedFileQueue(aLockedFile);
if (!fileStorageInfo->HasRunningLockedFiles()) {
mFileStorageInfos.Remove(storageId);
if (!storageInfo->HasRunningLockedFiles()) {
mStorageInfos.Remove(storageId);
// See if we need to fire any complete callbacks.
uint32_t index = 0;
@ -252,7 +255,7 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
void
FileService::WaitForStoragesToComplete(
nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
nsIRunnable* aCallback)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -269,19 +272,18 @@ FileService::WaitForStoragesToComplete(
}
void
FileService::AbortLockedFilesForStorage(nsIFileStorage* aFileStorage)
FileService::AbortLockedFilesForStorage(nsIOfflineStorage* aStorage)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aFileStorage, "Null pointer!");
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
MOZ_ASSERT(aStorage, "Null pointer!");
FileStorageInfo* fileStorageInfo;
if (!mFileStorageInfos.Get(aFileStorage->Id(), &fileStorageInfo)) {
StorageInfo* storageInfo;
if (!mStorageInfos.Get(aStorage->Id(), &storageInfo)) {
return;
}
nsAutoTArray<nsRefPtr<LockedFile>, 10> lockedFiles;
fileStorageInfo->CollectRunningAndDelayedLockedFiles(aFileStorage,
lockedFiles);
storageInfo->CollectRunningAndDelayedLockedFiles(aStorage, lockedFiles);
for (uint32_t index = 0; index < lockedFiles.Length(); index++) {
ErrorResult ignored;
@ -290,17 +292,17 @@ FileService::AbortLockedFilesForStorage(nsIFileStorage* aFileStorage)
}
bool
FileService::HasLockedFilesForStorage(nsIFileStorage* aFileStorage)
FileService::HasLockedFilesForStorage(nsIOfflineStorage* aStorage)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aFileStorage, "Null pointer!");
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
MOZ_ASSERT(aStorage, "Null pointer!");
FileStorageInfo* fileStorageInfo;
if (!mFileStorageInfos.Get(aFileStorage->Id(), &fileStorageInfo)) {
StorageInfo* storageInfo;
if (!mStorageInfos.Get(aStorage->Id(), &storageInfo)) {
return false;
}
return fileStorageInfo->HasRunningLockedFiles(aFileStorage);
return storageInfo->HasRunningLockedFiles(aStorage);
}
NS_IMPL_ISUPPORTS(FileService, nsIObserver)
@ -323,7 +325,7 @@ FileService::MaybeFireCallback(StoragesCompleteCallback& aCallback)
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
for (uint32_t index = 0; index < aCallback.mStorages.Length(); index++) {
if (mFileStorageInfos.Get(aCallback.mStorages[index]->Id(), nullptr)) {
if (mStorageInfos.Get(aCallback.mStorages[index]->Id(), nullptr)) {
return false;
}
}
@ -395,8 +397,16 @@ FileService::LockedFileQueue::ProcessQueue()
return NS_OK;
}
FileService::DelayedEnqueueInfo::DelayedEnqueueInfo()
{
}
FileService::DelayedEnqueueInfo::~DelayedEnqueueInfo()
{
}
FileService::LockedFileQueue*
FileService::FileStorageInfo::CreateLockedFileQueue(LockedFile* aLockedFile)
FileService::StorageInfo::CreateLockedFileQueue(LockedFile* aLockedFile)
{
nsRefPtr<LockedFileQueue>* lockedFileQueue =
mLockedFileQueues.AppendElement();
@ -405,7 +415,7 @@ FileService::FileStorageInfo::CreateLockedFileQueue(LockedFile* aLockedFile)
}
FileService::LockedFileQueue*
FileService::FileStorageInfo::GetLockedFileQueue(LockedFile* aLockedFile)
FileService::StorageInfo::GetLockedFileQueue(LockedFile* aLockedFile)
{
uint32_t count = mLockedFileQueues.Length();
for (uint32_t index = 0; index < count; index++) {
@ -418,7 +428,7 @@ FileService::FileStorageInfo::GetLockedFileQueue(LockedFile* aLockedFile)
}
void
FileService::FileStorageInfo::RemoveLockedFileQueue(LockedFile* aLockedFile)
FileService::StorageInfo::RemoveLockedFileQueue(LockedFile* aLockedFile)
{
for (uint32_t index = 0; index < mDelayedEnqueueInfos.Length(); index++) {
if (mDelayedEnqueueInfos[index].mLockedFile == aLockedFile) {
@ -479,12 +489,11 @@ FileService::FileStorageInfo::RemoveLockedFileQueue(LockedFile* aLockedFile)
}
bool
FileService::FileStorageInfo::HasRunningLockedFiles(
nsIFileStorage* aFileStorage)
FileService::StorageInfo::HasRunningLockedFiles(nsIOfflineStorage* aStorage)
{
for (uint32_t index = 0; index < mLockedFileQueues.Length(); index++) {
LockedFile* lockedFile = mLockedFileQueues[index]->mLockedFile;
if (lockedFile->mFileHandle->mFileStorage == aFileStorage) {
if (lockedFile->mFileHandle->Storage() == aStorage) {
return true;
}
}
@ -492,8 +501,8 @@ FileService::FileStorageInfo::HasRunningLockedFiles(
}
FileService::DelayedEnqueueInfo*
FileService::FileStorageInfo::CreateDelayedEnqueueInfo(LockedFile* aLockedFile,
FileHelper* aFileHelper)
FileService::StorageInfo::CreateDelayedEnqueueInfo(LockedFile* aLockedFile,
FileHelper* aFileHelper)
{
DelayedEnqueueInfo* info = mDelayedEnqueueInfos.AppendElement();
info->mLockedFile = aLockedFile;
@ -502,21 +511,24 @@ FileService::FileStorageInfo::CreateDelayedEnqueueInfo(LockedFile* aLockedFile,
}
void
FileService::FileStorageInfo::CollectRunningAndDelayedLockedFiles(
nsIFileStorage* aFileStorage,
FileService::StorageInfo::CollectRunningAndDelayedLockedFiles(
nsIOfflineStorage* aStorage,
nsTArray<nsRefPtr<LockedFile> >& aLockedFiles)
{
for (uint32_t index = 0; index < mLockedFileQueues.Length(); index++) {
LockedFile* lockedFile = mLockedFileQueues[index]->mLockedFile;
if (lockedFile->mFileHandle->mFileStorage == aFileStorage) {
if (lockedFile->mFileHandle->Storage() == aStorage) {
aLockedFiles.AppendElement(lockedFile);
}
}
for (uint32_t index = 0; index < mDelayedEnqueueInfos.Length(); index++) {
LockedFile* lockedFile = mDelayedEnqueueInfos[index].mLockedFile;
if (lockedFile->mFileHandle->mFileStorage == aFileStorage) {
if (lockedFile->mFileHandle->Storage() == aStorage) {
aLockedFiles.AppendElement(lockedFile);
}
}
}
} // 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 nsIOfflineStorage;
class nsIRunnable;
BEGIN_FILE_NAMESPACE
namespace mozilla {
namespace dom {
class LockedFile;
class FileService MOZ_FINAL : public nsIObserver
{
@ -47,14 +56,14 @@ public:
NotifyLockedFileCompleted(LockedFile* aLockedFile);
void
WaitForStoragesToComplete(nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
WaitForStoragesToComplete(nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
nsIRunnable* aCallback);
void
AbortLockedFilesForStorage(nsIFileStorage* aFileStorage);
AbortLockedFilesForStorage(nsIOfflineStorage* aStorage);
bool
HasLockedFilesForStorage(nsIFileStorage* aFileStorage);
HasLockedFilesForStorage(nsIOfflineStorage* aStorage);
nsIEventTarget*
StreamTransportTarget()
@ -97,11 +106,14 @@ private:
struct DelayedEnqueueInfo
{
DelayedEnqueueInfo();
~DelayedEnqueueInfo();
nsRefPtr<LockedFile> mLockedFile;
nsRefPtr<FileHelper> mFileHelper;
};
class FileStorageInfo
class StorageInfo
{
friend class FileService;
@ -122,14 +134,14 @@ private:
}
inline bool
HasRunningLockedFiles(nsIFileStorage* aFileStorage);
HasRunningLockedFiles(nsIOfflineStorage* aStorage);
inline DelayedEnqueueInfo*
CreateDelayedEnqueueInfo(LockedFile* aLockedFile, FileHelper* aFileHelper);
inline void
CollectRunningAndDelayedLockedFiles(
nsIFileStorage* aFileStorage,
nsIOfflineStorage* aStorage,
nsTArray<nsRefPtr<LockedFile> >& aLockedFiles);
void
@ -157,7 +169,7 @@ private:
}
private:
FileStorageInfo()
StorageInfo()
{
}
@ -169,7 +181,7 @@ private:
struct StoragesCompleteCallback
{
nsTArray<nsCOMPtr<nsIFileStorage> > mStorages;
nsTArray<nsCOMPtr<nsIOfflineStorage> > mStorages;
nsCOMPtr<nsIRunnable> mCallback;
};
@ -186,10 +198,11 @@ private:
MaybeFireCallback(StoragesCompleteCallback& aCallback);
nsCOMPtr<nsIEventTarget> mStreamTransportTarget;
nsClassHashtable<nsCStringHashKey, FileStorageInfo> mFileStorageInfos;
nsClassHashtable<nsCStringHashKey, StorageInfo> mStorageInfos;
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 "FileHandle.h"
#include "FileHelper.h"
#include "MainThreadUtils.h"
#include "mozilla/Attributes.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIRunnable.h"
#include "nsISeekableStream.h"
#include "nsThreadUtils.h"
USING_FILE_NAMESPACE
namespace mozilla {
namespace dom {
namespace {
@ -247,7 +252,7 @@ FileOutputStreamWrapper::Close()
if (!mFirstTime) {
NS_ASSERTION(PR_GetCurrentThread() == mWriteThread,
"Unsetting thread locals on wrong thread!");
mFileHelper->mFileStorage->UnsetThreadLocals();
mFileHelper->mFileHandle->UnsetThreadLocals();
}
if (mFlags & NOTIFY_CLOSE) {
@ -278,7 +283,7 @@ FileOutputStreamWrapper::Write(const char* aBuf, uint32_t aCount,
#ifdef DEBUG
mWriteThread = PR_GetCurrentThread();
#endif
mFileHelper->mFileStorage->SetThreadLocals();
mFileHelper->mFileHandle->SetThreadLocals();
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mOutputStream);
if (seekable) {
@ -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,28 @@
#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 "nsIFileStorage.h"
#include "nsIEventTarget.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 +149,7 @@ class FlushHelper : public FileHelper
{
public:
FlushHelper(LockedFile* aLockedFile,
FileRequest* aFileRequest)
FileRequest* aFileRequest)
: FileHelper(aLockedFile, aFileRequest)
{ }
@ -196,7 +198,7 @@ private:
};
already_AddRefed<nsIDOMEvent>
CreateGenericEvent(mozilla::dom::EventTarget* aEventOwner,
CreateGenericEvent(EventTarget* aEventOwner,
const nsAString& aType, bool aBubbles, bool aCancelable)
{
nsCOMPtr<nsIDOMEvent> event;
@ -313,8 +315,7 @@ LockedFile::CreateParallelStream(nsISupports** aStream)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsIFileStorage* fileStorage = mFileHandle->mFileStorage;
if (fileStorage->IsInvalidated()) {
if (mFileHandle->IsInvalid()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -333,8 +334,7 @@ LockedFile::GetOrCreateStream(nsISupports** aStream)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsIFileStorage* fileStorage = mFileHandle->mFileStorage;
if (fileStorage->IsInvalidated()) {
if (mFileHandle->IsInvalid()) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -850,8 +850,7 @@ FinishHelper::Run()
return NS_OK;
}
nsIFileStorage* fileStorage = mLockedFile->mFileHandle->mFileStorage;
if (fileStorage->IsInvalidated()) {
if (mLockedFile->mFileHandle->IsInvalid()) {
mAborted = true;
}
@ -1058,4 +1057,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

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

@ -6,18 +6,8 @@
TEST_DIRS += ['test']
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 +16,6 @@ EXPORTS.mozilla.dom.file += [
]
UNIFIED_SOURCES += [
'ArchiveEvent.cpp',
'ArchiveReader.cpp',
'ArchiveRequest.cpp',
'ArchiveZipEvent.cpp',
'ArchiveZipFile.cpp',
'AsyncHelper.cpp',
'File.cpp',
'FileHandle.cpp',

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

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

@ -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']

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

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

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

@ -487,7 +487,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBDatabase, IDBWrapperCache)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBDatabase)
NS_INTERFACE_MAP_ENTRY(nsIFileStorage)
NS_INTERFACE_MAP_ENTRY(nsIOfflineStorage)
NS_INTERFACE_MAP_END_INHERITING(IDBWrapperCache)
@ -745,31 +744,6 @@ IDBDatabase::Id()
return mDatabaseId;
}
NS_IMETHODIMP_(bool)
IDBDatabase::IsInvalidated()
{
return mInvalidated;
}
NS_IMETHODIMP_(bool)
IDBDatabase::IsShuttingDown()
{
return QuotaManager::IsShuttingDown();
}
NS_IMETHODIMP_(void)
IDBDatabase::SetThreadLocals()
{
NS_ASSERTION(GetOwner(), "Should have owner!");
QuotaManager::SetCurrentWindow(GetOwner());
}
NS_IMETHODIMP_(void)
IDBDatabase::UnsetThreadLocals()
{
QuotaManager::SetCurrentWindow(nullptr);
}
NS_IMETHODIMP_(mozilla::dom::quota::Client*)
IDBDatabase::GetClient()
{
@ -954,7 +928,7 @@ CreateFileHelper::GetSuccessResult(JSContext* aCx,
JS::MutableHandle<JS::Value> aVal)
{
nsRefPtr<IDBFileHandle> fileHandle =
IDBFileHandle::Create(mDatabase, mName, mType, mFileInfo.forget());
IDBFileHandle::Create(mName, mType, mDatabase, mFileInfo.forget());
IDB_ENSURE_TRUE(fileHandle, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return WrapNative(aCx, NS_ISUPPORTS_CAST(EventTarget*, fileHandle), aVal);

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

@ -10,7 +10,6 @@
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsIDocument.h"
#include "nsIFileStorage.h"
#include "nsIOfflineStorage.h"
#include "mozilla/Attributes.h"
@ -59,7 +58,6 @@ class IDBDatabase : public IDBWrapperCache,
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIFILESTORAGE
NS_DECL_NSIOFFLINESTORAGE
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBDatabase, IDBWrapperCache)
@ -75,13 +73,6 @@ public:
static IDBDatabase*
FromStorage(nsIOfflineStorage* aStorage);
static IDBDatabase*
FromStorage(nsIFileStorage* aStorage)
{
nsCOMPtr<nsIOfflineStorage> storage = do_QueryInterface(aStorage);
return storage ? FromStorage(storage) : nullptr;
}
// nsIDOMEventTarget
virtual nsresult PostHandleEvent(
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
@ -111,6 +102,14 @@ public:
return doc.forget();
}
// Whether or not the database has been invalidated. If it has then no further
// transactions for this database will be allowed to run. This function may be
// called on any thread.
bool IsInvalidated() const
{
return mInvalidated;
}
void DisconnectFromActorParent();
void CloseInternal(bool aIsDead);

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

@ -6,9 +6,10 @@
#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"
#include "mozilla/dom/quota/QuotaManager.h"
#include "IDBDatabase.h"
@ -40,11 +41,19 @@ IDBFileHandle::IDBFileHandle(IDBDatabase* aOwner)
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(IDBFileHandle, FileHandle, mDatabase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBFileHandle)
NS_INTERFACE_MAP_END_INHERITING(FileHandle)
NS_IMPL_ADDREF_INHERITED(IDBFileHandle, FileHandle)
NS_IMPL_RELEASE_INHERITED(IDBFileHandle, FileHandle)
// static
already_AddRefed<IDBFileHandle>
IDBFileHandle::Create(IDBDatabase* aDatabase,
const nsAString& aName,
IDBFileHandle::Create(const nsAString& aName,
const nsAString& aType,
IDBDatabase* aDatabase,
already_AddRefed<FileInfo> aFileInfo)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -54,28 +63,45 @@ IDBFileHandle::Create(IDBDatabase* aDatabase,
nsRefPtr<IDBFileHandle> newFile = new IDBFileHandle(aDatabase);
newFile->mFileStorage = aDatabase;
newFile->mName = aName;
newFile->mType = aType;
newFile->mFile = GetFileFor(fileInfo);
NS_ENSURE_TRUE(newFile->mFile, nullptr);
newFile->mStorageId = aDatabase->Id();
newFile->mFileName.AppendInt(fileInfo->Id());
newFile->mDatabase = aDatabase;
fileInfo.swap(newFile->mFileInfo);
return newFile.forget();
}
bool
IDBFileHandle::IsShuttingDown()
{
return QuotaManager::IsShuttingDown() || FileHandle::IsShuttingDown();
}
bool
IDBFileHandle::IsInvalid()
{
return mDatabase->IsInvalidated();
}
nsIOfflineStorage*
IDBFileHandle::Storage()
{
return mDatabase;
}
already_AddRefed<nsISupports>
IDBFileHandle::CreateStream(nsIFile* aFile, bool aReadOnly)
{
nsCOMPtr<nsIOfflineStorage> storage = do_QueryInterface(mFileStorage);
NS_ASSERTION(storage, "This should always succeed!");
PersistenceType persistenceType = storage->Type();
const nsACString& group = storage->Group();
const nsACString& origin = storage->Origin();
PersistenceType persistenceType = mDatabase->Type();
const nsACString& group = mDatabase->Group();
const nsACString& origin = mDatabase->Origin();
nsCOMPtr<nsISupports> result;
@ -96,12 +122,25 @@ IDBFileHandle::CreateStream(nsIFile* aFile, bool aReadOnly)
return result.forget();
}
void
IDBFileHandle::SetThreadLocals()
{
MOZ_ASSERT(mDatabase->GetOwner(), "Should have owner!");
QuotaManager::SetCurrentWindow(mDatabase->GetOwner());
}
void
IDBFileHandle::UnsetThreadLocals()
{
QuotaManager::SetCurrentWindow(nullptr);
}
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();
}
@ -112,14 +151,3 @@ IDBFileHandle::WrapObject(JSContext* aCx)
{
return IDBFileHandleBinding::Wrap(aCx, this);
}
IDBDatabase*
IDBFileHandle::Database()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
IDBDatabase* database = static_cast<IDBDatabase*>(mFileStorage.get());
MOZ_ASSERT(database);
return database;
}

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

@ -9,21 +9,29 @@
#include "IndexedDatabase.h"
#include "mozilla/dom/file/FileHandle.h"
#include "MainThreadUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/FileHandle.h"
#include "mozilla/dom/indexedDB/FileInfo.h"
#include "nsCycleCollectionParticipant.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:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBFileHandle, FileHandle)
static already_AddRefed<IDBFileHandle>
Create(IDBDatabase* aDatabase, const nsAString& aName,
const nsAString& aType, already_AddRefed<FileInfo> aFileInfo);
Create(const nsAString& aName, const nsAString& aType,
IDBDatabase* aDatabase, already_AddRefed<FileInfo> aFileInfo);
virtual int64_t
@ -38,9 +46,24 @@ public:
return mFileInfo;
}
virtual bool
IsShuttingDown() MOZ_OVERRIDE;
virtual bool
IsInvalid() MOZ_OVERRIDE;
virtual nsIOfflineStorage*
Storage() MOZ_OVERRIDE;
virtual already_AddRefed<nsISupports>
CreateStream(nsIFile* aFile, bool aReadOnly) MOZ_OVERRIDE;
virtual void
SetThreadLocals() MOZ_OVERRIDE;
virtual void
UnsetThreadLocals() MOZ_OVERRIDE;
virtual already_AddRefed<nsIDOMFile>
CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize) MOZ_OVERRIDE;
@ -50,7 +73,12 @@ public:
// WebIDL
IDBDatabase*
Database();
Database()
{
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
return mDatabase;
}
private:
IDBFileHandle(IDBDatabase* aOwner);
@ -59,6 +87,7 @@ private:
{
}
nsRefPtr<IDBDatabase> mDatabase;
nsRefPtr<FileInfo> mFileInfo;
};

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

@ -777,8 +777,8 @@ public:
nsRefPtr<FileInfo>& fileInfo = aFile.mFileInfo;
nsRefPtr<IDBFileHandle> fileHandle = IDBFileHandle::Create(aDatabase,
aData.name, aData.type, fileInfo.forget());
nsRefPtr<IDBFileHandle> fileHandle = IDBFileHandle::Create(aData.name,
aData.type, aDatabase, fileInfo.forget());
return fileHandle->WrapObject(aCx);
}
@ -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();

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

@ -9,7 +9,6 @@
#include "nsIConsoleService.h"
#include "nsIDiskSpaceWatcher.h"
#include "nsIFile.h"
#include "nsIFileStorage.h"
#include "nsIObserverService.h"
#include "nsIScriptError.h"

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

@ -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) ==
@ -2418,7 +2419,7 @@ QuotaManager::Observe(nsISupports* aSubject,
}
}
StorageMatcher<nsTArray<nsCOMPtr<nsIFileStorage> > > liveStorages;
StorageMatcher<nsTArray<nsCOMPtr<nsIOfflineStorage>>> liveStorages;
liveStorages.Find(mLiveStorages, &indexes);
if (!liveStorages.IsEmpty()) {
@ -2795,7 +2796,7 @@ QuotaManager::RunSynchronizedOp(nsIOfflineStorage* aStorage,
if (service) {
// Have to copy here in case a transaction service needs a list too.
nsTArray<nsCOMPtr<nsIFileStorage> > array;
nsTArray<nsCOMPtr<nsIOfflineStorage>> array;
for (uint32_t index = startIndex; index < endIndex; index++) {
if (!storages[index].IsEmpty() &&

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

@ -7,13 +7,11 @@
#ifndef nsIOfflineStorage_h__
#define nsIOfflineStorage_h__
#include "nsIFileStorage.h"
#include "mozilla/dom/quota/PersistenceType.h"
#define NS_OFFLINESTORAGE_IID \
{0xec7e878d, 0xc8c1, 0x402e, \
{ 0xa2, 0xc4, 0xf6, 0x82, 0x29, 0x4e, 0x3c, 0xb1 } }
{0x3ae00063, 0x6c13, 0x4afd, \
{ 0x86, 0x7d, 0x33, 0xc2, 0x12, 0xd8, 0x97, 0x25 } }
class nsPIDOMWindow;
@ -25,7 +23,7 @@ class Client;
}
}
class nsIOfflineStorage : public nsIFileStorage
class nsIOfflineStorage : public nsISupports
{
public:
typedef mozilla::dom::quota::Client Client;
@ -33,6 +31,9 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_OFFLINESTORAGE_IID)
NS_IMETHOD_(const nsACString&)
Id() = 0;
NS_IMETHOD_(Client*)
GetClient() = 0;
@ -83,6 +84,9 @@ protected:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIOfflineStorage, NS_OFFLINESTORAGE_IID)
#define NS_DECL_NSIOFFLINESTORAGE \
NS_IMETHOD_(const nsACString&) \
Id() MOZ_OVERRIDE; \
\
NS_IMETHOD_(Client*) \
GetClient() MOZ_OVERRIDE; \
\

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

@ -33,6 +33,9 @@
#if defined(XP_WIN)
#include <windows.h>
#include <accctrl.h>
#define PATH_MAX MAX_PATH
#endif // defined(XP_WIN)
#include "jsapi.h"
@ -540,6 +543,8 @@ static const dom::ConstantSpec gLibcProperties[] =
INT_CONSTANT(S_IFSOCK),
#endif // defined(S_IFIFO)
INT_CONSTANT(PATH_MAX),
// Constants used to define data structures
//
// Many data structures have different fields/sizes/etc. on

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

@ -47,6 +47,10 @@ function debug(s) {
let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND =
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true";
// Ril quirk to control the uicc/data subscription.
let RILQUIRKS_SUBSCRIPTION_CONTROL =
libcutils.property_get("ro.moz.ril.subscription_control", "false") == "true";
// Ril quirk to always turn the radio off for the client without SIM card
// except hw default client.
let RILQUIRKS_RADIO_OFF_WO_CARD =
@ -787,7 +791,8 @@ XPCOMUtils.defineLazyGetter(this, "gDataConnectionManager", function () {
this._currentDataClientId = this._dataDefaultClientId;
let connHandler = this._connectionHandlers[this._currentDataClientId];
let radioInterface = connHandler.radioInterface;
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) {
radioInterface.setDataRegistration(true);
}
if (this._dataEnabled) {
@ -807,7 +812,8 @@ XPCOMUtils.defineLazyGetter(this, "gDataConnectionManager", function () {
let newSettings = newConnHandler.dataCallSettings;
if (!this._dataEnabled) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) {
oldIface.setDataRegistration(false);
newIface.setDataRegistration(true);
}
@ -823,7 +829,8 @@ XPCOMUtils.defineLazyGetter(this, "gDataConnectionManager", function () {
if (DEBUG) {
this.debug("Executing pending data call request.");
}
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) {
newIface.setDataRegistration(true);
}
newSettings.oldEnabled = newSettings.enabled;
@ -845,7 +852,8 @@ XPCOMUtils.defineLazyGetter(this, "gDataConnectionManager", function () {
newSettings.enabled = true;
this._currentDataClientId = this._dataDefaultClientId;
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) {
oldIface.setDataRegistration(false);
newIface.setDataRegistration(true);
}
@ -1631,10 +1639,8 @@ WorkerMessenger.prototype = {
libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true",
sendStkProfileDownload:
libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true",
dataRegistrationOnDemand:
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true",
subscriptionControl:
libcutils.property_get("ro.moz.ril.subscription_control", "false") == "true"
dataRegistrationOnDemand: RILQUIRKS_DATA_REGISTRATION_ON_DEMAND,
subscriptionControl: RILQUIRKS_SUBSCRIPTION_CONTROL
},
rilEmergencyNumbers: libcutils.property_get("ril.ecclist") ||
libcutils.property_get("ro.ril.ecclist")

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

@ -132,7 +132,9 @@ this.REQUEST_VOICE_RADIO_TECH = 108;
// Flame specific parcel types.
this.REQUEST_SET_UICC_SUBSCRIPTION = 114;
this.REQUEST_SET_DATA_SUBSCRIPTION = 115;
this.REQUEST_GET_UICC_SUBSCRIPTION = 116;
this.REQUEST_GET_DATA_SUBSCRIPTION = 117;
// UICC Secure Access.
this.REQUEST_SIM_OPEN_CHANNEL = 121;

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

@ -96,7 +96,7 @@ let RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD;
// Ril quirk to attach data registration on demand.
let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND;
// Ril quirk to control the uicc subscription.
// Ril quirk to control the uicc/data subscription.
let RILQUIRKS_SUBSCRIPTION_CONTROL;
function BufObject(aContext) {
@ -2143,10 +2143,15 @@ RilObject.prototype = {
* Boolean value indicating attach or detach.
*/
setDataRegistration: function(options) {
let request = options.attach ? RIL_REQUEST_GPRS_ATTACH :
RIL_REQUEST_GPRS_DETACH;
this._attachDataRegistration = options.attach;
this.context.Buf.simpleRequest(request);
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
let request = options.attach ? RIL_REQUEST_GPRS_ATTACH :
RIL_REQUEST_GPRS_DETACH;
this.context.Buf.simpleRequest(request);
} else if (RILQUIRKS_SUBSCRIPTION_CONTROL && options.attach) {
this.context.Buf.simpleRequest(REQUEST_SET_DATA_SUBSCRIPTION, options);
}
},
/**
@ -6413,7 +6418,9 @@ RilObject.prototype[REQUEST_VOICE_RADIO_TECH] = function REQUEST_VOICE_RADIO_TEC
this._processRadioTech(radioTech[0]);
};
RilObject.prototype[REQUEST_SET_UICC_SUBSCRIPTION] = null;
RilObject.prototype[REQUEST_SET_DATA_SUBSCRIPTION] = null;
RilObject.prototype[REQUEST_GET_UICC_SUBSCRIPTION] = null;
RilObject.prototype[REQUEST_GET_DATA_SUBSCRIPTION] = null;
RilObject.prototype[REQUEST_GET_UNLOCK_RETRY_COUNT] = function REQUEST_GET_UNLOCK_RETRY_COUNT(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
@ -6483,7 +6490,9 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
this.updateCellBroadcastConfig();
this.setPreferredNetworkType();
this.setCLIR();
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND && this._attachDataRegistration) {
if ((RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) &&
this._attachDataRegistration) {
this.setDataRegistration({attach: true});
}
}

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