2013-10-24 23:05:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-09-25 07:24:44 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsHostObjectProtocolHandler.h"
|
2015-08-21 00:18:57 +03:00
|
|
|
|
2014-10-03 12:18:00 +04:00
|
|
|
#include "DOMMediaStream.h"
|
2016-03-22 20:50:31 +03:00
|
|
|
#include "mozilla/dom/Exceptions.h"
|
2015-08-20 02:13:13 +03:00
|
|
|
#include "mozilla/dom/File.h"
|
2015-08-21 00:18:57 +03:00
|
|
|
#include "mozilla/dom/MediaSource.h"
|
2015-08-20 02:13:13 +03:00
|
|
|
#include "mozilla/LoadInfo.h"
|
2016-03-03 14:05:52 +03:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2015-08-21 00:18:57 +03:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "nsClassHashtable.h"
|
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsHostObjectURI.h"
|
|
|
|
#include "nsIMemoryReporter.h"
|
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIUUIDGenerator.h"
|
|
|
|
#include "nsNetUtil.h"
|
2012-09-25 07:24:44 +04:00
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
using mozilla::dom::BlobImpl;
|
2014-10-08 20:15:22 +04:00
|
|
|
using mozilla::ErrorResult;
|
2014-07-10 10:56:37 +04:00
|
|
|
using mozilla::LoadInfo;
|
2014-06-27 07:46:34 +04:00
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Hash table
|
|
|
|
struct DataInfo
|
|
|
|
{
|
2014-10-03 12:18:00 +04:00
|
|
|
// mObject is expected to be an nsIDOMBlob, DOMMediaStream, or MediaSource
|
2012-09-25 07:24:44 +04:00
|
|
|
nsCOMPtr<nsISupports> mObject;
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2016-05-17 21:34:39 +03:00
|
|
|
bool mPrivateBrowsing;
|
2014-01-16 17:22:26 +04:00
|
|
|
nsCString mStack;
|
2012-09-25 07:24:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static nsClassHashtable<nsCStringHashKey, DataInfo>* gDataTable;
|
|
|
|
|
2013-10-24 23:05:08 +04:00
|
|
|
// Memory reporting for the hash table.
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HostObjectURLsReporter final : public nsIMemoryReporter
|
2013-10-24 23:05:08 +04:00
|
|
|
{
|
2014-06-25 06:09:15 +04:00
|
|
|
~HostObjectURLsReporter() {}
|
|
|
|
|
2013-10-24 23:05:08 +04:00
|
|
|
public:
|
2013-12-08 10:09:10 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsISupports* aData, bool aAnonymize) override
|
2013-10-24 23:05:08 +04:00
|
|
|
{
|
2013-12-08 10:09:10 +04:00
|
|
|
return MOZ_COLLECT_REPORT(
|
|
|
|
"host-object-urls", KIND_OTHER, UNITS_COUNT,
|
|
|
|
gDataTable ? gDataTable->Count() : 0,
|
|
|
|
"The number of host objects stored for access via URLs "
|
|
|
|
"(e.g. blobs passed to URL.createObjectURL).");
|
2013-10-24 23:05:08 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(HostObjectURLsReporter, nsIMemoryReporter)
|
2013-12-08 10:09:10 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class BlobURLsReporter final : public nsIMemoryReporter
|
2014-01-16 17:22:26 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD CollectReports(nsIHandleReportCallback* aCallback,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsISupports* aData, bool aAnonymize) override
|
2014-01-16 17:22:26 +04:00
|
|
|
{
|
2015-10-27 08:19:59 +03:00
|
|
|
if (!gDataTable) {
|
|
|
|
return NS_OK;
|
2014-01-16 17:22:26 +04:00
|
|
|
}
|
2015-10-27 08:19:59 +03:00
|
|
|
|
|
|
|
nsDataHashtable<nsPtrHashKey<nsIDOMBlob>, uint32_t> refCounts;
|
|
|
|
|
|
|
|
// Determine number of URLs per blob, to handle the case where it's > 1.
|
|
|
|
for (auto iter = gDataTable->Iter(); !iter.Done(); iter.Next()) {
|
|
|
|
nsCOMPtr<nsIDOMBlob> blob =
|
|
|
|
do_QueryInterface(iter.UserData()->mObject);
|
|
|
|
if (blob) {
|
|
|
|
refCounts.Put(blob, refCounts.Get(blob) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto iter = gDataTable->Iter(); !iter.Done(); iter.Next()) {
|
|
|
|
nsCStringHashKey::KeyType key = iter.Key();
|
|
|
|
DataInfo* info = iter.UserData();
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMBlob> tmp = do_QueryInterface(info->mObject);
|
|
|
|
RefPtr<mozilla::dom::Blob> blob =
|
|
|
|
static_cast<mozilla::dom::Blob*>(tmp.get());
|
|
|
|
|
|
|
|
if (blob) {
|
|
|
|
NS_NAMED_LITERAL_CSTRING(desc,
|
|
|
|
"A blob URL allocated with URL.createObjectURL; the referenced "
|
|
|
|
"blob cannot be freed until all URLs for it have been explicitly "
|
|
|
|
"invalidated with URL.revokeObjectURL.");
|
|
|
|
nsAutoCString path, url, owner, specialDesc;
|
|
|
|
nsCOMPtr<nsIURI> principalURI;
|
|
|
|
uint64_t size = 0;
|
|
|
|
uint32_t refCount = 1;
|
|
|
|
DebugOnly<bool> blobWasCounted;
|
|
|
|
|
|
|
|
blobWasCounted = refCounts.Get(blob, &refCount);
|
|
|
|
MOZ_ASSERT(blobWasCounted);
|
|
|
|
MOZ_ASSERT(refCount > 0);
|
|
|
|
|
|
|
|
bool isMemoryFile = blob->IsMemoryFile();
|
|
|
|
|
|
|
|
if (isMemoryFile) {
|
|
|
|
ErrorResult rv;
|
|
|
|
size = blob->GetSize(rv);
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
rv.SuppressException();
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
path = isMemoryFile ? "memory-blob-urls/" : "file-blob-urls/";
|
|
|
|
BuildPath(path, key, info, aAnonymize);
|
|
|
|
|
|
|
|
if (refCount > 1) {
|
|
|
|
nsAutoCString addrStr;
|
|
|
|
|
|
|
|
addrStr = "0x";
|
|
|
|
addrStr.AppendInt((uint64_t)(nsIDOMBlob*)blob, 16);
|
|
|
|
|
|
|
|
path += " ";
|
|
|
|
path.AppendInt(refCount);
|
|
|
|
path += "@";
|
|
|
|
path += addrStr;
|
|
|
|
|
|
|
|
specialDesc = desc;
|
|
|
|
specialDesc += "\n\nNOTE: This blob (address ";
|
|
|
|
specialDesc += addrStr;
|
|
|
|
specialDesc += ") has ";
|
|
|
|
specialDesc.AppendInt(refCount);
|
|
|
|
specialDesc += " URLs.";
|
|
|
|
if (isMemoryFile) {
|
|
|
|
specialDesc += " Its size is divided ";
|
|
|
|
specialDesc += refCount > 2 ? "among" : "between";
|
|
|
|
specialDesc += " them in this report.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsACString& descString = specialDesc.IsEmpty()
|
|
|
|
? static_cast<const nsACString&>(desc)
|
|
|
|
: static_cast<const nsACString&>(specialDesc);
|
|
|
|
if (isMemoryFile) {
|
|
|
|
aCallback->Callback(EmptyCString(),
|
|
|
|
path,
|
|
|
|
KIND_OTHER,
|
|
|
|
UNITS_BYTES,
|
|
|
|
size / refCount,
|
|
|
|
descString,
|
|
|
|
aData);
|
|
|
|
} else {
|
|
|
|
aCallback->Callback(EmptyCString(),
|
|
|
|
path,
|
|
|
|
KIND_OTHER,
|
|
|
|
UNITS_COUNT,
|
|
|
|
1,
|
|
|
|
descString,
|
|
|
|
aData);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Just report the path for the DOMMediaStream or MediaSource.
|
|
|
|
nsCOMPtr<mozilla::dom::MediaSource>
|
|
|
|
ms(do_QueryInterface(info->mObject));
|
|
|
|
nsAutoCString path;
|
|
|
|
path = ms ? "media-source-urls/" : "dom-media-stream-urls/";
|
|
|
|
BuildPath(path, key, info, aAnonymize);
|
|
|
|
|
|
|
|
NS_NAMED_LITERAL_CSTRING(desc,
|
|
|
|
"An object URL allocated with URL.createObjectURL; the referenced "
|
|
|
|
"data cannot be freed until all URLs for it have been explicitly "
|
|
|
|
"invalidated with URL.revokeObjectURL.");
|
|
|
|
|
|
|
|
aCallback->Callback(EmptyCString(),
|
|
|
|
path,
|
|
|
|
KIND_OTHER,
|
|
|
|
UNITS_COUNT,
|
|
|
|
1,
|
|
|
|
desc,
|
|
|
|
aData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-16 17:22:26 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize info->mStack to record JS stack info, if enabled.
|
|
|
|
// The string generated here is used in ReportCallback, below.
|
|
|
|
static void GetJSStackForBlob(DataInfo* aInfo)
|
|
|
|
{
|
|
|
|
nsCString& stack = aInfo->mStack;
|
|
|
|
MOZ_ASSERT(stack.IsEmpty());
|
|
|
|
const uint32_t maxFrames = Preferences::GetUint("memory.blob_report.stack_frames");
|
|
|
|
|
|
|
|
if (maxFrames == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-22 20:50:31 +03:00
|
|
|
nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack(maxFrames);
|
2014-01-16 17:22:26 +04:00
|
|
|
|
|
|
|
nsAutoCString origin;
|
|
|
|
nsCOMPtr<nsIURI> principalURI;
|
|
|
|
if (NS_SUCCEEDED(aInfo->mPrincipal->GetURI(getter_AddRefs(principalURI)))
|
|
|
|
&& principalURI) {
|
|
|
|
principalURI->GetPrePath(origin);
|
|
|
|
}
|
|
|
|
|
2016-03-22 20:50:31 +03:00
|
|
|
// If we got a frame, we better have a current JSContext. This is cheating
|
|
|
|
// a bit; ideally we'd have our caller pass in a JSContext, or have
|
|
|
|
// GetCurrentJSStack() hand out the JSContext it found.
|
|
|
|
JSContext* cx = frame ? nsContentUtils::GetCurrentJSContext() : nullptr;
|
|
|
|
|
2016-03-22 20:50:31 +03:00
|
|
|
for (uint32_t i = 0; frame; ++i) {
|
2014-04-12 06:20:40 +04:00
|
|
|
nsString fileNameUTF16;
|
2014-01-16 17:22:26 +04:00
|
|
|
int32_t lineNumber = 0;
|
|
|
|
|
2016-03-22 20:50:31 +03:00
|
|
|
frame->GetFilename(cx, fileNameUTF16);
|
2016-03-22 20:50:31 +03:00
|
|
|
frame->GetLineNumber(cx, &lineNumber);
|
2014-01-16 17:22:26 +04:00
|
|
|
|
2014-04-12 06:20:40 +04:00
|
|
|
if (!fileNameUTF16.IsEmpty()) {
|
|
|
|
NS_ConvertUTF16toUTF8 fileName(fileNameUTF16);
|
2014-01-16 17:22:26 +04:00
|
|
|
stack += "js(";
|
|
|
|
if (!origin.IsEmpty()) {
|
|
|
|
// Make the file name root-relative for conciseness if possible.
|
|
|
|
const char* originData;
|
|
|
|
uint32_t originLen;
|
|
|
|
|
|
|
|
originLen = origin.GetData(&originData);
|
|
|
|
// If fileName starts with origin + "/", cut up to that "/".
|
2014-01-20 20:51:41 +04:00
|
|
|
if (fileName.Length() >= originLen + 1 &&
|
|
|
|
memcmp(fileName.get(), originData, originLen) == 0 &&
|
2014-01-16 17:22:26 +04:00
|
|
|
fileName[originLen] == '/') {
|
2014-01-20 20:51:41 +04:00
|
|
|
fileName.Cut(0, originLen);
|
2014-01-16 17:22:26 +04:00
|
|
|
}
|
|
|
|
}
|
2014-01-20 20:51:41 +04:00
|
|
|
fileName.ReplaceChar('/', '\\');
|
|
|
|
stack += fileName;
|
2014-01-16 17:22:26 +04:00
|
|
|
if (lineNumber > 0) {
|
|
|
|
stack += ", line=";
|
|
|
|
stack.AppendInt(lineNumber);
|
|
|
|
}
|
|
|
|
stack += ")/";
|
|
|
|
}
|
|
|
|
|
2016-03-22 20:50:31 +03:00
|
|
|
nsCOMPtr<nsIStackFrame> caller;
|
2016-03-22 20:50:35 +03:00
|
|
|
nsresult rv = frame->GetCaller(cx, getter_AddRefs(caller));
|
2014-01-16 17:22:26 +04:00
|
|
|
NS_ENSURE_SUCCESS_VOID(rv);
|
2016-03-22 20:50:31 +03:00
|
|
|
caller.swap(frame);
|
2014-01-16 17:22:26 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-06-25 06:09:15 +04:00
|
|
|
~BlobURLsReporter() {}
|
|
|
|
|
2015-04-17 02:20:03 +03:00
|
|
|
static void BuildPath(nsAutoCString& path,
|
|
|
|
nsCStringHashKey::KeyType aKey,
|
|
|
|
DataInfo* aInfo,
|
|
|
|
bool anonymize)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIURI> principalURI;
|
|
|
|
nsAutoCString url, owner;
|
|
|
|
if (NS_SUCCEEDED(aInfo->mPrincipal->GetURI(getter_AddRefs(principalURI))) &&
|
|
|
|
principalURI != nullptr &&
|
|
|
|
NS_SUCCEEDED(principalURI->GetSpec(owner)) &&
|
|
|
|
!owner.IsEmpty()) {
|
|
|
|
owner.ReplaceChar('/', '\\');
|
|
|
|
path += "owner(";
|
|
|
|
if (anonymize) {
|
|
|
|
path += "<anonymized>";
|
|
|
|
} else {
|
|
|
|
path += owner;
|
|
|
|
}
|
|
|
|
path += ")";
|
|
|
|
} else {
|
|
|
|
path += "owner unknown";
|
|
|
|
}
|
|
|
|
path += "/";
|
|
|
|
if (anonymize) {
|
|
|
|
path += "<anonymized-stack>";
|
|
|
|
} else {
|
|
|
|
path += aInfo->mStack;
|
|
|
|
}
|
|
|
|
url = aKey;
|
|
|
|
url.ReplaceChar('/', '\\');
|
|
|
|
if (anonymize) {
|
|
|
|
path += "<anonymized-url>";
|
|
|
|
} else {
|
|
|
|
path += url;
|
|
|
|
}
|
|
|
|
}
|
2014-01-16 17:22:26 +04:00
|
|
|
};
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(BlobURLsReporter, nsIMemoryReporter)
|
2014-01-16 17:22:26 +04:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2013-10-24 23:05:08 +04:00
|
|
|
|
2014-03-03 23:35:00 +04:00
|
|
|
void
|
|
|
|
nsHostObjectProtocolHandler::Init(void)
|
2013-10-24 23:05:08 +04:00
|
|
|
{
|
|
|
|
static bool initialized = false;
|
|
|
|
|
|
|
|
if (!initialized) {
|
|
|
|
initialized = true;
|
2013-11-07 09:35:30 +04:00
|
|
|
RegisterStrongMemoryReporter(new mozilla::HostObjectURLsReporter());
|
2014-01-16 17:22:26 +04:00
|
|
|
RegisterStrongMemoryReporter(new mozilla::BlobURLsReporter());
|
2013-10-24 23:05:08 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-03 23:35:00 +04:00
|
|
|
nsHostObjectProtocolHandler::nsHostObjectProtocolHandler()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2014-01-16 17:22:26 +04:00
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
nsresult
|
|
|
|
nsHostObjectProtocolHandler::AddDataEntry(const nsACString& aScheme,
|
|
|
|
nsISupports* aObject,
|
|
|
|
nsIPrincipal* aPrincipal,
|
2016-05-17 21:34:39 +03:00
|
|
|
bool aPrivateBrowsing,
|
2012-09-25 07:24:44 +04:00
|
|
|
nsACString& aUri)
|
|
|
|
{
|
2014-03-03 23:35:00 +04:00
|
|
|
Init();
|
|
|
|
|
2014-08-31 14:40:11 +04:00
|
|
|
nsresult rv = GenerateURIString(aScheme, aPrincipal, aUri);
|
2012-09-25 07:24:44 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (!gDataTable) {
|
|
|
|
gDataTable = new nsClassHashtable<nsCStringHashKey, DataInfo>;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataInfo* info = new DataInfo;
|
|
|
|
|
|
|
|
info->mObject = aObject;
|
|
|
|
info->mPrincipal = aPrincipal;
|
2016-05-17 21:34:39 +03:00
|
|
|
info->mPrivateBrowsing = aPrivateBrowsing;
|
2014-01-16 17:22:26 +04:00
|
|
|
mozilla::BlobURLsReporter::GetJSStackForBlob(info);
|
2012-09-25 07:24:44 +04:00
|
|
|
|
|
|
|
gDataTable->Put(aUri, info);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHostObjectProtocolHandler::RemoveDataEntry(const nsACString& aUri)
|
|
|
|
{
|
|
|
|
if (gDataTable) {
|
2013-10-17 22:37:57 +04:00
|
|
|
nsCString uriIgnoringRef;
|
|
|
|
int32_t hashPos = aUri.FindChar('#');
|
|
|
|
if (hashPos < 0) {
|
|
|
|
uriIgnoringRef = aUri;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
uriIgnoringRef = StringHead(aUri, hashPos);
|
|
|
|
}
|
|
|
|
gDataTable->Remove(uriIgnoringRef);
|
2012-09-25 07:24:44 +04:00
|
|
|
if (gDataTable->Count() == 0) {
|
|
|
|
delete gDataTable;
|
|
|
|
gDataTable = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-10 16:25:12 +04:00
|
|
|
nsresult
|
|
|
|
nsHostObjectProtocolHandler::GenerateURIString(const nsACString &aScheme,
|
2014-08-31 14:40:11 +04:00
|
|
|
nsIPrincipal* aPrincipal,
|
2013-06-10 16:25:12 +04:00
|
|
|
nsACString& aUri)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIUUIDGenerator> uuidgen =
|
|
|
|
do_GetService("@mozilla.org/uuid-generator;1", &rv);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
nsID id;
|
|
|
|
rv = uuidgen->GenerateUUIDInPlace(&id);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
char chars[NSID_LENGTH];
|
|
|
|
id.ToProvidedString(chars);
|
|
|
|
|
2014-08-31 14:40:11 +04:00
|
|
|
aUri = aScheme;
|
|
|
|
aUri.Append(':');
|
|
|
|
|
|
|
|
if (aPrincipal) {
|
2015-05-07 21:20:33 +03:00
|
|
|
nsAutoCString origin;
|
|
|
|
rv = nsContentUtils::GetASCIIOrigin(aPrincipal, origin);
|
2014-08-31 14:40:11 +04:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2015-05-07 21:20:33 +03:00
|
|
|
aUri.Append(origin);
|
2014-08-31 14:40:11 +04:00
|
|
|
aUri.Append('/');
|
|
|
|
}
|
|
|
|
|
2013-06-10 16:25:12 +04:00
|
|
|
aUri += Substring(chars + 1, chars + NSID_LENGTH - 2);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-10-17 22:37:57 +04:00
|
|
|
static DataInfo*
|
|
|
|
GetDataInfo(const nsACString& aUri)
|
|
|
|
{
|
|
|
|
if (!gDataTable) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataInfo* res;
|
2015-10-14 14:48:00 +03:00
|
|
|
|
|
|
|
// Let's remove any fragment and query from this URI.
|
|
|
|
int32_t hasFragmentPos = aUri.FindChar('#');
|
|
|
|
int32_t hasQueryPos = aUri.FindChar('?');
|
|
|
|
|
|
|
|
int32_t pos = -1;
|
|
|
|
if (hasFragmentPos >= 0 && hasQueryPos >= 0) {
|
|
|
|
pos = std::min(hasFragmentPos, hasQueryPos);
|
|
|
|
} else if (hasFragmentPos >= 0) {
|
|
|
|
pos = hasFragmentPos;
|
|
|
|
} else {
|
|
|
|
pos = hasQueryPos;
|
2013-10-17 22:37:57 +04:00
|
|
|
}
|
2015-10-14 14:48:00 +03:00
|
|
|
|
|
|
|
if (pos < 0) {
|
|
|
|
gDataTable->Get(aUri, &res);
|
|
|
|
} else {
|
|
|
|
gDataTable->Get(StringHead(aUri, pos), &res);
|
2013-10-17 22:37:57 +04:00
|
|
|
}
|
2015-10-14 14:48:00 +03:00
|
|
|
|
2013-10-17 22:37:57 +04:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
nsIPrincipal*
|
|
|
|
nsHostObjectProtocolHandler::GetDataEntryPrincipal(const nsACString& aUri)
|
|
|
|
{
|
|
|
|
if (!gDataTable) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2013-10-17 22:37:57 +04:00
|
|
|
DataInfo* res = GetDataInfo(aUri);
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
if (!res) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res->mPrincipal;
|
|
|
|
}
|
|
|
|
|
2013-05-03 04:54:05 +04:00
|
|
|
void
|
|
|
|
nsHostObjectProtocolHandler::Traverse(const nsACString& aUri,
|
|
|
|
nsCycleCollectionTraversalCallback& aCallback)
|
|
|
|
{
|
|
|
|
if (!gDataTable) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataInfo* res;
|
|
|
|
gDataTable->Get(aUri, &res);
|
|
|
|
if (!res) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCallback, "HostObjectProtocolHandler DataInfo.mObject");
|
|
|
|
aCallback.NoteXPCOMChild(res->mObject);
|
|
|
|
}
|
|
|
|
|
2015-05-21 04:49:50 +03:00
|
|
|
static nsISupports*
|
|
|
|
GetDataObjectForSpec(const nsACString& aSpec)
|
|
|
|
{
|
|
|
|
DataInfo* info = GetDataInfo(aSpec);
|
|
|
|
return info ? info->mObject : nullptr;
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
static nsISupports*
|
|
|
|
GetDataObject(nsIURI* aURI)
|
|
|
|
{
|
|
|
|
nsCString spec;
|
|
|
|
aURI->GetSpec(spec);
|
2015-05-21 04:49:50 +03:00
|
|
|
return GetDataObjectForSpec(spec);
|
2012-09-25 07:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Protocol handler
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsHostObjectProtocolHandler, nsIProtocolHandler)
|
2012-09-25 07:24:44 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHostObjectProtocolHandler::GetDefaultPort(int32_t *result)
|
|
|
|
{
|
|
|
|
*result = -1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHostObjectProtocolHandler::GetProtocolFlags(uint32_t *result)
|
|
|
|
{
|
|
|
|
*result = URI_NORELATIVE | URI_NOAUTH | URI_LOADABLE_BY_SUBSUMERS |
|
|
|
|
URI_IS_LOCAL_RESOURCE | URI_NON_PERSISTABLE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHostObjectProtocolHandler::NewURI(const nsACString& aSpec,
|
|
|
|
const char *aCharset,
|
|
|
|
nsIURI *aBaseURI,
|
|
|
|
nsIURI **aResult)
|
|
|
|
{
|
|
|
|
*aResult = nullptr;
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
DataInfo* info = GetDataInfo(aSpec);
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsHostObjectURI> uri =
|
2012-09-25 07:24:44 +04:00
|
|
|
new nsHostObjectURI(info ? info->mPrincipal.get() : nullptr);
|
|
|
|
|
|
|
|
rv = uri->SetSpec(aSpec);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
NS_TryToSetImmutable(uri);
|
|
|
|
uri.forget(aResult);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-10-23 04:16:57 +04:00
|
|
|
nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
|
2014-12-12 20:06:09 +03:00
|
|
|
nsILoadInfo* aLoadInfo,
|
2014-10-23 04:16:57 +04:00
|
|
|
nsIChannel** result)
|
2012-09-25 07:24:44 +04:00
|
|
|
{
|
|
|
|
*result = nullptr;
|
|
|
|
|
|
|
|
nsCString spec;
|
|
|
|
uri->GetSpec(spec);
|
|
|
|
|
|
|
|
DataInfo* info = GetDataInfo(spec);
|
|
|
|
|
|
|
|
if (!info) {
|
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
2014-06-27 07:46:34 +04:00
|
|
|
|
2016-05-17 21:34:39 +03:00
|
|
|
bool usePrivateBrowsing = false;
|
|
|
|
ErrorResult rv;
|
|
|
|
rv = aLoadInfo->GetUsePrivateBrowsing(&usePrivateBrowsing);
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->mPrivateBrowsing != usePrivateBrowsing) {
|
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
nsCOMPtr<BlobImpl> blob = do_QueryInterface(info->mObject);
|
2015-01-12 00:34:31 +03:00
|
|
|
if (!blob) {
|
2012-09-25 07:24:44 +04:00
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(uri);
|
|
|
|
nsCOMPtr<nsIPrincipal> principal;
|
|
|
|
uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
|
|
|
NS_ASSERTION(info->mPrincipal == principal, "Wrong principal!");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsCOMPtr<nsIInputStream> stream;
|
2015-05-19 17:36:37 +03:00
|
|
|
blob->GetInternalStream(getter_AddRefs(stream), rv);
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
|
|
|
}
|
2012-09-25 07:24:44 +04:00
|
|
|
|
2015-10-20 04:24:36 +03:00
|
|
|
nsAutoString contentType;
|
|
|
|
blob->GetType(contentType);
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
nsCOMPtr<nsIChannel> channel;
|
2015-02-19 22:47:59 +03:00
|
|
|
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
|
|
|
uri,
|
|
|
|
stream,
|
2015-10-20 04:24:36 +03:00
|
|
|
NS_ConvertUTF16toUTF8(contentType),
|
2015-02-19 22:47:59 +03:00
|
|
|
EmptyCString(), // aContentCharset
|
|
|
|
aLoadInfo);
|
2015-05-19 17:36:37 +03:00
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
|
|
|
}
|
2012-09-25 07:24:44 +04:00
|
|
|
|
2013-03-22 02:23:48 +04:00
|
|
|
nsString type;
|
2014-10-08 20:15:22 +04:00
|
|
|
blob->GetType(type);
|
2012-09-25 07:24:44 +04:00
|
|
|
|
2014-06-27 07:46:34 +04:00
|
|
|
if (blob->IsFile()) {
|
2013-09-27 09:22:37 +04:00
|
|
|
nsString filename;
|
2014-10-08 20:15:22 +04:00
|
|
|
blob->GetName(filename);
|
2013-09-27 09:22:37 +04:00
|
|
|
channel->SetContentDispositionFilename(filename);
|
2013-06-21 07:15:15 +04:00
|
|
|
}
|
2013-07-02 08:23:37 +04:00
|
|
|
|
2015-05-19 17:36:37 +03:00
|
|
|
uint64_t size = blob->GetSize(rv);
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
2014-10-08 20:15:22 +04:00
|
|
|
}
|
2013-09-27 09:22:37 +04:00
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
channel->SetOriginalURI(uri);
|
|
|
|
channel->SetContentType(NS_ConvertUTF16toUTF8(type));
|
2013-09-27 09:22:37 +04:00
|
|
|
channel->SetContentLength(size);
|
2012-09-25 07:24:44 +04:00
|
|
|
|
|
|
|
channel.forget(result);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-10-23 04:16:57 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
|
|
|
{
|
|
|
|
return NewChannel2(uri, nullptr, result);
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHostObjectProtocolHandler::AllowPort(int32_t port, const char *scheme,
|
|
|
|
bool *_retval)
|
|
|
|
{
|
|
|
|
// don't override anything.
|
|
|
|
*_retval = false;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBlobProtocolHandler::GetScheme(nsACString &result)
|
|
|
|
{
|
|
|
|
result.AssignLiteral(BLOBURI_SCHEME);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMediaStreamProtocolHandler::GetScheme(nsACString &result)
|
|
|
|
{
|
|
|
|
result.AssignLiteral(MEDIASTREAMURI_SCHEME);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-06-21 07:15:15 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMediaSourceProtocolHandler::GetScheme(nsACString &result)
|
|
|
|
{
|
|
|
|
result.AssignLiteral(MEDIASOURCEURI_SCHEME);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-06-10 16:25:12 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFontTableProtocolHandler::GetScheme(nsACString &result)
|
|
|
|
{
|
|
|
|
result.AssignLiteral(FONTTABLEURI_SCHEME);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
nsresult
|
2015-05-12 15:11:03 +03:00
|
|
|
NS_GetBlobForBlobURI(nsIURI* aURI, BlobImpl** aBlob)
|
2012-09-25 07:24:44 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION(IsBlobURI(aURI), "Only call this with blob URIs");
|
|
|
|
|
2014-10-06 22:01:20 +04:00
|
|
|
*aBlob = nullptr;
|
2012-09-25 07:24:44 +04:00
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
nsCOMPtr<BlobImpl> blob = do_QueryInterface(GetDataObject(aURI));
|
2015-01-12 00:34:31 +03:00
|
|
|
if (!blob) {
|
2012-09-25 07:24:44 +04:00
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
2014-10-06 22:01:20 +04:00
|
|
|
blob.forget(aBlob);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-21 04:49:50 +03:00
|
|
|
nsresult
|
|
|
|
NS_GetBlobForBlobURISpec(const nsACString& aSpec, BlobImpl** aBlob)
|
|
|
|
{
|
|
|
|
*aBlob = nullptr;
|
|
|
|
|
|
|
|
nsCOMPtr<BlobImpl> blob = do_QueryInterface(GetDataObjectForSpec(aSpec));
|
|
|
|
if (!blob) {
|
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
|
|
|
blob.forget(aBlob);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-10-06 22:01:20 +04:00
|
|
|
nsresult
|
|
|
|
NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<BlobImpl> blobImpl;
|
2015-05-19 17:36:37 +03:00
|
|
|
ErrorResult rv;
|
|
|
|
rv = NS_GetBlobForBlobURI(aURI, getter_AddRefs(blobImpl));
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
blobImpl->GetInternalStream(aStream, rv);
|
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
|
|
|
return rv.StealNSResult();
|
2014-10-06 22:01:20 +04:00
|
|
|
}
|
|
|
|
|
2015-05-19 17:36:37 +03:00
|
|
|
return NS_OK;
|
2012-09-25 07:24:44 +04:00
|
|
|
}
|
2012-09-25 07:24:44 +04:00
|
|
|
|
|
|
|
nsresult
|
2014-10-03 12:18:00 +04:00
|
|
|
NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream)
|
2012-09-25 07:24:44 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION(IsMediaStreamURI(aURI), "Only call this with mediastream URIs");
|
|
|
|
|
2014-12-23 21:43:29 +03:00
|
|
|
nsISupports* dataObject = GetDataObject(aURI);
|
|
|
|
if (!dataObject) {
|
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:24:44 +04:00
|
|
|
*aStream = nullptr;
|
2014-12-23 21:43:29 +03:00
|
|
|
return CallQueryInterface(dataObject, aStream);
|
2012-09-25 07:24:44 +04:00
|
|
|
}
|
2013-06-21 07:15:15 +04:00
|
|
|
|
2013-06-10 16:25:12 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFontTableProtocolHandler::NewURI(const nsACString& aSpec,
|
|
|
|
const char *aCharset,
|
|
|
|
nsIURI *aBaseURI,
|
|
|
|
nsIURI **aResult)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsIURI> uri;
|
2013-06-10 16:25:12 +04:00
|
|
|
|
|
|
|
// Either you got here via a ref or a fonttable: uri
|
|
|
|
if (aSpec.Length() && aSpec.CharAt(0) == '#') {
|
|
|
|
nsresult rv = aBaseURI->CloneIgnoringRef(getter_AddRefs(uri));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
uri->SetRef(aSpec);
|
|
|
|
} else {
|
|
|
|
// Relative URIs (other than #ref) are not meaningful within the
|
|
|
|
// fonttable: scheme.
|
|
|
|
// If aSpec is a relative URI -other- than a bare #ref,
|
|
|
|
// this will leave uri empty, and we'll return a failure code below.
|
|
|
|
uri = new nsSimpleURI();
|
|
|
|
uri->SetSpec(aSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool schemeIs;
|
|
|
|
if (NS_FAILED(uri->SchemeIs(FONTTABLEURI_SCHEME, &schemeIs)) || !schemeIs) {
|
|
|
|
NS_WARNING("Non-fonttable spec in nsFontTableProtocolHander");
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uri.forget(aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-06-21 07:15:15 +04:00
|
|
|
nsresult
|
|
|
|
NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(IsMediaSourceURI(aURI), "Only call this with mediasource URIs");
|
|
|
|
|
|
|
|
*aSource = nullptr;
|
|
|
|
|
|
|
|
nsCOMPtr<mozilla::dom::MediaSource> source = do_QueryInterface(GetDataObject(aURI));
|
|
|
|
if (!source) {
|
|
|
|
return NS_ERROR_DOM_BAD_URI;
|
|
|
|
}
|
|
|
|
|
|
|
|
source.forget(aSource);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2016-03-03 14:05:52 +03:00
|
|
|
|
|
|
|
#define NS_BLOBPROTOCOLHANDLER_CID \
|
|
|
|
{ 0xb43964aa, 0xa078, 0x44b2, \
|
|
|
|
{ 0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 } }
|
|
|
|
|
|
|
|
#define NS_MEDIASTREAMPROTOCOLHANDLER_CID \
|
|
|
|
{ 0x27d1fa24, 0x2b73, 0x4db3, \
|
|
|
|
{ 0xab, 0x48, 0xb9, 0x83, 0x83, 0x40, 0xe0, 0x81 } }
|
|
|
|
|
|
|
|
#define NS_MEDIASOURCEPROTOCOLHANDLER_CID \
|
|
|
|
{ 0x12ef31fc, 0xa8fb, 0x4661, \
|
|
|
|
{ 0x9a, 0x63, 0xfb, 0x61, 0x04,0x5d, 0xb8, 0x61 } }
|
|
|
|
|
|
|
|
#define NS_FONTTABLEPROTOCOLHANDLER_CID \
|
|
|
|
{ 0x3fc8f04e, 0xd719, 0x43ca, \
|
|
|
|
{ 0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 } }
|
|
|
|
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlobProtocolHandler)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaStreamProtocolHandler)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSourceProtocolHandler)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontTableProtocolHandler)
|
|
|
|
|
|
|
|
NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_MEDIASTREAMPROTOCOLHANDLER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_MEDIASOURCEPROTOCOLHANDLER_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID);
|
|
|
|
|
|
|
|
static const mozilla::Module::CIDEntry kHostObjectProtocolHandlerCIDs[] = {
|
|
|
|
{ &kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, nsBlobProtocolHandlerConstructor },
|
|
|
|
{ &kNS_MEDIASTREAMPROTOCOLHANDLER_CID, false, nullptr, nsMediaStreamProtocolHandlerConstructor },
|
|
|
|
{ &kNS_MEDIASOURCEPROTOCOLHANDLER_CID, false, nullptr, nsMediaSourceProtocolHandlerConstructor },
|
|
|
|
{ &kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr, nsFontTableProtocolHandlerConstructor },
|
|
|
|
{ nullptr }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const mozilla::Module::ContractIDEntry kHostObjectProtocolHandlerContracts[] = {
|
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, &kNS_BLOBPROTOCOLHANDLER_CID },
|
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASTREAMURI_SCHEME, &kNS_MEDIASTREAMPROTOCOLHANDLER_CID },
|
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MEDIASOURCEURI_SCHEME, &kNS_MEDIASOURCEPROTOCOLHANDLER_CID },
|
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME, &kNS_FONTTABLEPROTOCOLHANDLER_CID },
|
|
|
|
{ nullptr }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const mozilla::Module kHostObjectProtocolHandlerModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kHostObjectProtocolHandlerCIDs,
|
|
|
|
kHostObjectProtocolHandlerContracts
|
|
|
|
};
|
|
|
|
|
|
|
|
NSMODULE_DEFN(HostObjectProtocolHandler) = &kHostObjectProtocolHandlerModule;
|