зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1809126 - Remove moz-fonttable protocol. r=jfkthame,necko-reviewers
We only use it to generate a dummy URI for SVG-in-Opentype documents. We don't really need the URIs to be unique or anything in practice. I noticed this code while looking at the load flags set up for bug 1809006. Differential Revision: https://phabricator.services.mozilla.com/D166291
This commit is contained in:
Родитель
79418c1985
Коммит
90e1d8d837
|
@ -168,7 +168,6 @@
|
|||
#include "mozilla/dom/FileBlobImpl.h"
|
||||
#include "mozilla/dom/FileSystemSecurity.h"
|
||||
#include "mozilla/dom/FilteredNodeIterator.h"
|
||||
#include "mozilla/dom/FontTableURIProtocolHandler.h"
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
#include "mozilla/dom/FromParser.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
@ -3824,7 +3823,7 @@ nsresult nsContentUtils::LoadImage(
|
|||
|
||||
nsIURI* documentURI = aLoadingDocument->GetDocumentURI();
|
||||
|
||||
NS_ASSERTION(loadGroup || IsFontTableURI(documentURI),
|
||||
NS_ASSERTION(loadGroup || aLoadingDocument->IsSVGGlyphsDocument(),
|
||||
"Could not get loadgroup; onload may fire too early");
|
||||
|
||||
// XXXbz using "documentURI" for the initialDocumentURI is not quite
|
||||
|
|
|
@ -9,10 +9,6 @@ var uris = [
|
|||
uri: "rstp://1.2.3.4/some_path?param=a",
|
||||
local: false,
|
||||
},
|
||||
{
|
||||
uri: "moz-fonttable://something",
|
||||
local: true,
|
||||
},
|
||||
];
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FontTableURIProtocolHandler.h"
|
||||
#include "nsIDUtils.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsSimpleURI.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/* static */
|
||||
nsresult FontTableURIProtocolHandler::GenerateURIString(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);
|
||||
|
||||
aUri = FONTTABLEURI_SCHEME;
|
||||
aUri.Append(':');
|
||||
|
||||
aUri += NSID_TrimBracketsASCII(id);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
FontTableURIProtocolHandler::FontTableURIProtocolHandler() = default;
|
||||
FontTableURIProtocolHandler::~FontTableURIProtocolHandler() = default;
|
||||
|
||||
NS_IMPL_ISUPPORTS(FontTableURIProtocolHandler, nsIProtocolHandler,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::AllowPort(int32_t port, const char* scheme,
|
||||
bool* _retval) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::GetScheme(nsACString& result) {
|
||||
result.AssignLiteral(FONTTABLEURI_SCHEME);
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=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 FontTableURIProtocolHandler_h
|
||||
#define FontTableURIProtocolHandler_h
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#define FONTTABLEURI_SCHEME "moz-fonttable"
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
class FontTableURIProtocolHandler final : public nsIProtocolHandler,
|
||||
public nsSupportsWeakReference {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
FontTableURIProtocolHandler();
|
||||
|
||||
static nsresult GenerateURIString(nsACString& aUri);
|
||||
|
||||
protected:
|
||||
virtual ~FontTableURIProtocolHandler();
|
||||
};
|
||||
|
||||
inline bool IsFontTableURI(nsIURI* aUri) {
|
||||
return aUri->SchemeIs(FONTTABLEURI_SCHEME);
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
#endif /* FontTableURIProtocolHandler_h */
|
|
@ -5,22 +5,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{3fc8f04e-d719-43ca-9ad0-18ee320211f2}',
|
||||
'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-fonttable'],
|
||||
'type': 'mozilla::dom::FontTableURIProtocolHandler',
|
||||
'headers': ['mozilla/dom/FontTableURIProtocolHandler.h'],
|
||||
'protocol_config': {
|
||||
'scheme': 'moz-fonttable',
|
||||
'flags': [
|
||||
'URI_NORELATIVE',
|
||||
'URI_NOAUTH',
|
||||
'URI_LOADABLE_BY_SUBSUMERS',
|
||||
'URI_NON_PERSISTABLE',
|
||||
'URI_IS_LOCAL_RESOURCE',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
'cid': '{b43964aa-a078-44b2-b06b-fd4d1b172e66}',
|
||||
'contract_ids': ['@mozilla.org/network/protocol;1?name=blob'],
|
||||
|
|
|
@ -11,7 +11,6 @@ EXPORTS.mozilla.dom += [
|
|||
"BlobURL.h",
|
||||
"BlobURLInputStream.h",
|
||||
"BlobURLProtocolHandler.h",
|
||||
"FontTableURIProtocolHandler.h",
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
@ -19,7 +18,6 @@ UNIFIED_SOURCES += [
|
|||
"BlobURLChannel.cpp",
|
||||
"BlobURLInputStream.cpp",
|
||||
"BlobURLProtocolHandler.cpp",
|
||||
"FontTableURIProtocolHandler.cpp",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "mozilla/SVGUtils.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/FontTableURIProtocolHandler.h"
|
||||
#include "mozilla/dom/ImageTracker.h"
|
||||
#include "mozilla/dom/SVGDocument.h"
|
||||
#include "nsError.h"
|
||||
|
@ -370,11 +369,9 @@ nsresult gfxSVGGlyphsDocument::ParseDocument(const uint8_t* aBuffer,
|
|||
nsresult rv = CreateBufferedStream(aBuffer, aBufLen, stream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We just need a dummy URI.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mozilla::dom::FontTableURIProtocolHandler::GenerateURIString(
|
||||
mSVGGlyphsDocumentURI);
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(uri), mSVGGlyphsDocumentURI);
|
||||
rv = NS_NewURI(getter_AddRefs(uri), "moz-svg-glyphs://"_ns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
|
@ -465,6 +462,5 @@ void gfxSVGGlyphsDocument::InsertGlyphId(Element* aGlyphElement) {
|
|||
size_t gfxSVGGlyphsDocument::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
return aMallocSizeOf(this) +
|
||||
mGlyphIdMap.ShallowSizeOfExcludingThis(aMallocSizeOf) +
|
||||
mSVGGlyphsDocumentURI.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
mGlyphIdMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
|
|
@ -67,8 +67,6 @@ class gfxSVGGlyphsDocument final : public nsAPostRefreshObserver {
|
|||
RefPtr<mozilla::PresShell> mPresShell;
|
||||
|
||||
nsBaseHashtable<nsUint32HashKey, Element*, Element*> mGlyphIdMap;
|
||||
|
||||
nsCString mSVGGlyphsDocumentURI;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -149,7 +147,7 @@ class gfxSVGGlyphs {
|
|||
mozilla::AutoSwap_PRUint16 mVersion;
|
||||
mozilla::AutoSwap_PRUint32 mDocIndexOffset;
|
||||
mozilla::AutoSwap_PRUint32 mColorPalettesOffset;
|
||||
} * mHeader;
|
||||
}* mHeader;
|
||||
|
||||
struct IndexEntry {
|
||||
mozilla::AutoSwap_PRUint16 mStartGlyph;
|
||||
|
@ -161,7 +159,7 @@ class gfxSVGGlyphs {
|
|||
const struct DocIndex {
|
||||
mozilla::AutoSwap_PRUint16 mNumEntries;
|
||||
IndexEntry mEntries[1]; /* actual length = mNumEntries */
|
||||
} * mDocIndex;
|
||||
}* mDocIndex;
|
||||
|
||||
static int CompareIndexEntries(const void* _a, const void* _b);
|
||||
};
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "mozilla/InputTaskManager.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/dom/FontTableURIProtocolHandler.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -1738,8 +1737,7 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
|||
// Image documents receive ticks from clients' refresh drivers.
|
||||
// XXXdholbert Exclude SVG-in-opentype fonts from this optimization, until
|
||||
// they receive refresh-driver ticks from their client docs (bug 1107252).
|
||||
nsIURI* uri = mPresContext->Document()->GetDocumentURI();
|
||||
if (!uri || !mozilla::dom::IsFontTableURI(uri)) {
|
||||
if (!mPresContext->Document()->IsSVGGlyphsDocument()) {
|
||||
MOZ_ASSERT(!mActiveTimer,
|
||||
"image doc refresh driver should never have its own timer");
|
||||
return;
|
||||
|
|
|
@ -1888,8 +1888,7 @@ nsresult NS_NewURI(nsIURI** aURI, const nsACString& aSpec,
|
|||
|
||||
if (scheme.EqualsLiteral("moz-safe-about") ||
|
||||
scheme.EqualsLiteral("page-icon") || scheme.EqualsLiteral("moz") ||
|
||||
scheme.EqualsLiteral("moz-anno") ||
|
||||
scheme.EqualsLiteral("moz-fonttable")) {
|
||||
scheme.EqualsLiteral("moz-anno")) {
|
||||
return NS_MutateURI(new nsSimpleURI::Mutator())
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(aURI);
|
||||
|
|
Загрузка…
Ссылка в новой задаче