Backed out changeset 5fcbba2f8f8c (bug 1720353) for failures on test_bug1281963.html. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2022-02-10 19:42:46 +02:00
Родитель 55e4577c2f
Коммит ae252d9945
16 изменённых файлов: 149 добавлений и 302 удалений

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

@ -1602,6 +1602,10 @@ pref("toolkit.startup.max_resumed_crashes", 3);
pref("toolkit.winRegisterApplicationRestart", true);
#endif
// Completely disable pdf.js as an option to preview pdfs within firefox.
// Note: if this is not disabled it does not necessarily mean pdf.js is the pdf
// handler just that it is an option.
pref("pdfjs.disabled", false);
// Used by pdf.js to know the first time firefox is run with it installed so it
// can become the default pdf viewer.
pref("pdfjs.firstRun", true);

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

@ -32,7 +32,6 @@
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_pdfjs.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StorageAccess.h"
#include "mozilla/Telemetry.h"
@ -145,6 +144,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
@ -176,7 +176,11 @@ void Navigator::Invalidate() {
// Don't clear mWindow here so we know we've got a non-null mWindow
// until we're unlinked.
mPlugins = nullptr;
mMimeTypes = nullptr;
if (mPlugins) {
mPlugins = nullptr;
}
mPermissions = nullptr;
@ -472,12 +476,15 @@ void Navigator::GetProductSub(nsAString& aProductSub) {
}
nsMimeTypeArray* Navigator::GetMimeTypes(ErrorResult& aRv) {
auto* plugins = GetPlugins(aRv);
if (!plugins) {
return nullptr;
if (!mMimeTypes) {
if (!mWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
mMimeTypes = new nsMimeTypeArray(mWindow);
}
return plugins->MimeTypeArray();
return mMimeTypes;
}
nsPluginArray* Navigator::GetPlugins(ErrorResult& aRv) {
@ -486,14 +493,12 @@ nsPluginArray* Navigator::GetPlugins(ErrorResult& aRv) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
mPlugins = MakeRefPtr<nsPluginArray>(mWindow);
mPlugins = new nsPluginArray(mWindow);
}
return mPlugins;
}
bool Navigator::PdfViewerEnabled() { return !StaticPrefs::pdfjs_disabled(); }
Permissions* Navigator::GetPermissions(ErrorResult& aRv) {
if (!mWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);

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

@ -125,7 +125,6 @@ class Navigator final : public nsISupports, public nsWrapperCache {
ErrorResult& aRv);
nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
nsPluginArray* GetPlugins(ErrorResult& aRv);
bool PdfViewerEnabled();
Permissions* GetPermissions(ErrorResult& aRv);
void GetDoNotTrack(nsAString& aResult);
bool GlobalPrivacyControl();
@ -266,6 +265,7 @@ class Navigator final : public nsISupports, public nsWrapperCache {
return mWindow ? mWindow->GetDocShell() : nullptr;
}
RefPtr<nsMimeTypeArray> mMimeTypes;
RefPtr<nsPluginArray> mPlugins;
RefPtr<Permissions> mPermissions;
RefPtr<Geolocation> mGeolocation;

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

@ -8,8 +8,6 @@
#include "mozilla/dom/MimeTypeArrayBinding.h"
#include "mozilla/dom/MimeTypeBinding.h"
#include "nsPluginArray.h"
#include "mozilla/StaticPrefs_pdfjs.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -21,13 +19,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsMimeTypeArray)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeTypeArray, mWindow, mMimeTypes[0],
mMimeTypes[1])
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeTypeArray, mWindow)
nsMimeTypeArray::nsMimeTypeArray(
nsPIDOMWindowInner* aWindow,
const mozilla::Array<RefPtr<nsMimeType>, 2>& aMimeTypes)
: mWindow(aWindow), mMimeTypes(aMimeTypes) {}
nsMimeTypeArray::nsMimeTypeArray(nsPIDOMWindowInner* aWindow)
: mWindow(aWindow) {}
nsMimeTypeArray::~nsMimeTypeArray() = default;
@ -41,61 +36,7 @@ nsPIDOMWindowInner* nsMimeTypeArray::GetParentObject() const {
return mWindow;
}
nsMimeType* nsMimeTypeArray::IndexedGetter(uint32_t aIndex, bool& aFound) {
if (!PdfViewerDisabled() && aIndex < ArrayLength(mMimeTypes)) {
aFound = true;
return mMimeTypes[aIndex];
}
aFound = false;
return nullptr;
}
nsMimeType* nsMimeTypeArray::NamedGetter(const nsAString& aName, bool& aFound) {
if (PdfViewerDisabled()) {
aFound = false;
return nullptr;
}
for (const auto& mimeType : mMimeTypes) {
if (mimeType->Name().Equals(aName)) {
aFound = true;
return mimeType;
}
}
aFound = false;
return nullptr;
}
void nsMimeTypeArray::GetSupportedNames(nsTArray<nsString>& retval) {
if (PdfViewerDisabled()) {
return;
}
for (auto& mimeType : mMimeTypes) {
retval.AppendElement(mimeType->Name());
}
}
/* static */
bool nsMimeTypeArray::PdfViewerDisabled() {
return StaticPrefs::pdfjs_disabled();
}
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsMimeType, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsMimeType, Release)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mPluginElement)
nsMimeType::nsMimeType(nsPluginElement* aPluginElement, const nsAString& aName)
: mPluginElement(aPluginElement), mName(aName) {
MOZ_ASSERT(aPluginElement);
}
nsMimeType::~nsMimeType() = default;
JSObject* nsMimeType::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return MimeType_Binding::Wrap(aCx, this, aGivenProto);
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType)

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

@ -17,15 +17,11 @@ class nsMimeType;
class nsPluginElement;
/**
* Array class backing HTML's navigator.mimeTypes. This always holds
* references to the hard-coded set of PDF MIME types defined by HTML but it
* only consults them if "pdfjs.disabled" is false. There is never more
* than one of these per DOM window.
* Array class backing HTML's navigator.mimeTypes. This array is always empty.
*/
class nsMimeTypeArray final : public nsISupports, public nsWrapperCache {
public:
nsMimeTypeArray(nsPIDOMWindowInner* aWindow,
const mozilla::Array<RefPtr<nsMimeType>, 2>& aMimeTypes);
explicit nsMimeTypeArray(nsPIDOMWindowInner* aWindow);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsMimeTypeArray)
@ -35,82 +31,69 @@ class nsMimeTypeArray final : public nsISupports, public nsWrapperCache {
JS::Handle<JSObject*> aGivenProto) override;
// MimeTypeArray WebIDL methods
uint32_t Length() {
return PdfViewerDisabled() ? 0 : ArrayLength(mMimeTypes);
nsMimeType* Item(uint32_t index) { return nullptr; }
nsMimeType* NamedItem(const nsAString& name) { return nullptr; }
nsMimeType* IndexedGetter(uint32_t index, bool& found) { return nullptr; }
nsMimeType* NamedGetter(const nsAString& name, bool& found) {
return nullptr;
}
nsMimeType* Item(uint32_t aIndex) {
bool unused;
return IndexedGetter(aIndex, unused);
}
uint32_t Length() { return 0; }
nsMimeType* NamedItem(const nsAString& aName) {
bool unused;
return NamedGetter(aName, unused);
}
nsMimeType* IndexedGetter(uint32_t index, bool& found);
nsMimeType* NamedGetter(const nsAString& name, bool& found);
void GetSupportedNames(nsTArray<nsString>& retval);
void GetSupportedNames(nsTArray<nsString>& retval) {}
protected:
virtual ~nsMimeTypeArray();
static bool PdfViewerDisabled();
nsCOMPtr<nsPIDOMWindowInner> mWindow;
mozilla::Array<RefPtr<nsMimeType>, 2> mMimeTypes;
};
/**
* Mime type class backing entries in HTML's navigator.mimeTypes array. There
* is a fixed set of these, as defined by HTML.
* Mime type class backing entries in HTML's navigator.mimeTypes array.
* Currently, these cannot be constructed.
*/
class nsMimeType final : public nsWrapperCache {
public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsMimeType)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType)
nsMimeType(nsPluginElement* aPluginElement, const nsAString& aName);
// Never constructed.
nsMimeType() = delete;
nsPluginElement* GetParentObject() const { return mPluginElement; }
nsPIDOMWindowInner* GetParentObject() const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
return nullptr;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
JS::Handle<JSObject*> aGivenProto) override {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
return nullptr;
}
// MimeType WebIDL methods
void GetDescription(mozilla::dom::DOMString& retval) const {
retval.SetKnownLiveString(kMimeDescription);
void GetDescription(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
}
already_AddRefed<nsPluginElement> EnabledPlugin() const {
return do_AddRef(mPluginElement);
nsPluginElement* GetEnabledPlugin() const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
return nullptr;
}
void GetSuffixes(mozilla::dom::DOMString& retval) const {
retval.SetKnownLiveString(kMimeSuffix);
void GetSuffixes(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
}
void GetType(nsString& retval) const { retval = mName; }
const nsString& Name() const { return mName; }
void GetType(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
}
protected:
virtual ~nsMimeType();
static constexpr nsLiteralString kMimeDescription =
u"Portable Document Format"_ns;
static constexpr nsLiteralString kMimeSuffix = u"pdf"_ns;
// Note that this creates an explicit reference cycle:
//
// nsMimeType -> nsPluginElement -> nsPluginArray ->
// nsMimeTypeArray -> nsMimeType
//
// We rely on the cycle collector to break this cycle.
RefPtr<nsPluginElement> mPluginElement;
nsString mName;
virtual ~nsMimeType() = default;
};
#endif /* nsMimeTypeArray_h___ */

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

@ -8,43 +8,13 @@
#include "mozilla/dom/PluginArrayBinding.h"
#include "mozilla/dom/PluginBinding.h"
#include "mozilla/StaticPrefs_pdfjs.h"
#include "nsMimeTypeArray.h"
#include "nsPIDOMWindow.h"
using namespace mozilla;
using namespace mozilla::dom;
// These plugin and mime types are hard-coded by the HTML spec.
// The "main" plugin name is used with the only plugin that is
// referenced by MIME types (via nsMimeType::GetEnabledPlugin).
// The "extra" of the plugin names are associated with MIME types that
// reference the main plugin.
// This is all defined in the HTML spec, section 8.9.1.6
// "PDF Viewing Support".
static const nsLiteralString kMainPluginName = u"PDF Viewer"_ns;
static const nsLiteralString kExtraPluginNames[] = {
u"Chrome PDF Viewer"_ns, u"Chromium PDF Viewer"_ns,
u"Microsoft Edge PDF Viewer"_ns, u"WebKit built-in PDF"_ns};
static const nsLiteralString kMimeTypeNames[] = {u"application/pdf"_ns,
u"text/pdf"_ns};
nsPluginArray::nsPluginArray(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) {
// Create the hard-coded PDF plugin types that share MIME type arrays.
mPlugins[0] = MakeRefPtr<nsPluginElement>(this, aWindow, kMainPluginName);
mozilla::Array<RefPtr<nsMimeType>, 2> mimeTypes;
for (uint32_t i = 0; i < ArrayLength(kMimeTypeNames); ++i) {
mimeTypes[i] = MakeRefPtr<nsMimeType>(mPlugins[0], kMimeTypeNames[i]);
}
mMimeTypeArray = MakeRefPtr<nsMimeTypeArray>(aWindow, mimeTypes);
for (uint32_t i = 0; i < ArrayLength(kExtraPluginNames); ++i) {
mPlugins[i + 1] =
MakeRefPtr<nsPluginElement>(this, aWindow, kExtraPluginNames[i]);
}
}
nsPluginArray::nsPluginArray(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) {}
nsPluginArray::~nsPluginArray() = default;
@ -58,49 +28,6 @@ JSObject* nsPluginArray::WrapObject(JSContext* aCx,
return PluginArray_Binding::Wrap(aCx, this, aGivenProto);
}
nsPluginElement* nsPluginArray::IndexedGetter(uint32_t aIndex, bool& aFound) {
if (!PdfViewerDisabled() && aIndex < ArrayLength(mPlugins)) {
aFound = true;
return mPlugins[aIndex];
}
aFound = false;
return nullptr;
}
nsPluginElement* nsPluginArray::NamedGetter(const nsAString& aName,
bool& aFound) {
if (PdfViewerDisabled()) {
aFound = false;
return nullptr;
}
for (const auto& plugin : mPlugins) {
if (plugin->Name().Equals(aName)) {
aFound = true;
return plugin;
}
}
aFound = false;
return nullptr;
}
void nsPluginArray::GetSupportedNames(nsTArray<nsString>& aRetval) {
if (PdfViewerDisabled()) {
return;
}
for (auto& plugin : mPlugins) {
aRetval.AppendElement(plugin->Name());
}
}
/* static */
bool nsPluginArray::PdfViewerDisabled() {
return StaticPrefs::pdfjs_disabled();
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPluginArray)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginArray)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginArray)
@ -109,39 +36,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginArray)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK(nsPluginArray, mPlugins[0],
mPlugins[1], mPlugins[2],
mPlugins[3], mPlugins[4],
mMimeTypeArray)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK(nsPluginArray, mWindow)
// nsPluginElement implementation.
nsPluginElement::nsPluginElement(nsPluginArray* aPluginArray,
nsPIDOMWindowInner* aWindow,
const nsAString& aName)
: mPluginArray(aPluginArray), mWindow(aWindow), mName(aName) {}
nsPluginArray* nsPluginElement::GetParentObject() const { return mPluginArray; }
JSObject* nsPluginElement::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return Plugin_Binding::Wrap(aCx, this, aGivenProto);
}
nsMimeType* nsPluginElement::IndexedGetter(uint32_t aIndex, bool& aFound) {
return MimeTypeArray()->IndexedGetter(aIndex, aFound);
}
nsMimeType* nsPluginElement::NamedGetter(const nsAString& aName, bool& aFound) {
return MimeTypeArray()->NamedGetter(aName, aFound);
}
void nsPluginElement::GetSupportedNames(nsTArray<nsString>& retval) {
return MimeTypeArray()->GetSupportedNames(retval);
}
uint32_t nsPluginElement::Length() { return MimeTypeArray()->Length(); }
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPluginElement)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginElement)
@ -149,4 +47,4 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginElement)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsPluginElement, mWindow, mPluginArray)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsPluginElement)

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

@ -15,14 +15,14 @@
class nsPIDOMWindowInner;
class nsPluginElement;
class nsMimeTypeArray;
class nsMimeType;
namespace mozilla::dom {
enum class CallerType : uint32_t;
} // namespace mozilla::dom
/**
* Array class backing HTML's navigator.plugins. This always holds references
* to the hard-coded set of PDF plugins defined by HTML but it only consults
* them if "pdfjs.disabled" is false. There is never more than one of these
* per DOM window.
* Array class backing HTML's navigator.plugins. This array is always empty.
*/
class nsPluginArray final : public nsSupportsWeakReference,
public nsWrapperCache {
@ -35,99 +35,108 @@ class nsPluginArray final : public nsSupportsWeakReference,
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsMimeTypeArray* MimeTypeArray() { return mMimeTypeArray; }
// PluginArray WebIDL methods
uint32_t Length() { return PdfViewerDisabled() ? 0 : ArrayLength(mPlugins); }
void Refresh(bool aReloadDocuments) {}
nsPluginElement* Item(uint32_t aIndex) {
bool unused;
return IndexedGetter(aIndex, unused);
nsPluginElement* Item(uint32_t aIndex, mozilla::dom::CallerType aCallerType) {
return nullptr;
}
nsPluginElement* NamedItem(const nsAString& aName) {
bool unused;
return NamedGetter(aName, unused);
nsPluginElement* NamedItem(const nsAString& aName,
mozilla::dom::CallerType aCallerType) {
return nullptr;
}
nsPluginElement* IndexedGetter(uint32_t aIndex, bool& aFound);
uint32_t Length(mozilla::dom::CallerType aCallerType) { return 0; }
nsPluginElement* NamedGetter(const nsAString& aName, bool& aFound);
nsPluginElement* IndexedGetter(uint32_t aIndex, bool& aFound,
mozilla::dom::CallerType aCallerType) {
return nullptr;
}
void GetSupportedNames(nsTArray<nsString>& aRetval);
nsPluginElement* NamedGetter(const nsAString& aName, bool& aFound,
mozilla::dom::CallerType aCallerType) {
return nullptr;
}
void Refresh() {}
void GetSupportedNames(nsTArray<nsString>& aRetval,
mozilla::dom::CallerType aCallerType) {}
private:
virtual ~nsPluginArray();
static bool PdfViewerDisabled();
RefPtr<nsMimeTypeArray> mMimeTypeArray;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
mozilla::Array<RefPtr<nsPluginElement>, 5> mPlugins;
};
/**
* Plugin class backing entries in HTML's navigator.plugins array. There is
* a fixed set of these, as defined by HTML.
* Plugin class backing entries in HTML's navigator.plugins array.
* Currently, these cannot be constructed.
*/
class nsPluginElement final : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPluginElement)
explicit nsPluginElement(nsPluginArray* aPluginArray,
nsPIDOMWindowInner* aWindow, const nsAString& aName);
nsPluginElement() = delete;
nsPluginArray* GetParentObject() const;
nsPIDOMWindowInner* GetParentObject() const {
MOZ_ASSERT_UNREACHABLE("nsMimeType can not exist");
return nullptr;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
JS::Handle<JSObject*> aGivenProto) override {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return nullptr;
}
// Plugin WebIDL methods
void GetDescription(nsString& retval) const { retval = kDescription; }
void GetDescription(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
}
void GetFilename(nsString& retval) const { retval = kFilename; }
void GetFilename(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
}
void GetName(nsString& retval) const { retval = mName; }
const nsString& Name() const { return mName; }
void GetVersion(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
}
void GetName(nsString& retval) const {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
}
nsMimeType* Item(uint32_t index) {
bool unused;
return IndexedGetter(index, unused);
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return nullptr;
}
nsMimeType* NamedItem(const nsAString& name) {
bool unused;
return NamedGetter(name, unused);
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return nullptr;
}
uint32_t Length() {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return 0;
}
uint32_t Length();
nsMimeType* IndexedGetter(uint32_t index, bool& found) {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return nullptr;
}
nsMimeType* IndexedGetter(uint32_t index, bool& found);
nsMimeType* NamedGetter(const nsAString& name, bool& found) {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
return nullptr;
}
nsMimeType* NamedGetter(const nsAString& name, bool& found);
void GetSupportedNames(nsTArray<nsString>& retval);
void GetSupportedNames(nsTArray<nsString>& retval) {
MOZ_ASSERT_UNREACHABLE("nsPluginElement can not exist");
}
protected:
virtual ~nsPluginElement() = default;
nsMimeTypeArray* MimeTypeArray() { return mPluginArray->MimeTypeArray(); }
static constexpr nsLiteralString kDescription =
u"Portable Document Format"_ns;
static constexpr nsLiteralString kFilename = u"internal-pdf-viewer"_ns;
// Note that this creates an explicit reference cycle:
//
// nsPluginElement -> nsPluginArray -> nsPluginElement
//
// We rely on the cycle collector to break this cycle.
RefPtr<nsPluginArray> mPluginArray;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsString mName;
};
#endif /* nsPluginArray_h___ */

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

@ -6,8 +6,8 @@
[Exposed=Window]
interface MimeType {
readonly attribute DOMString type;
readonly attribute DOMString description;
readonly attribute Plugin? enabledPlugin;
readonly attribute DOMString suffixes;
readonly attribute Plugin enabledPlugin;
readonly attribute DOMString type;
};

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

@ -8,6 +8,7 @@
Exposed=Window]
interface MimeTypeArray {
readonly attribute unsigned long length;
getter MimeType? item(unsigned long index);
getter MimeType? namedItem(DOMString name);
};

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

@ -105,12 +105,13 @@ partial interface Navigator {
readonly attribute Permissions permissions;
};
// Things that definitely need to be in the spec and and are not for some
// reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406
partial interface Navigator {
[Throws, SameObject]
[Throws]
readonly attribute MimeTypeArray mimeTypes;
[Throws, SameObject]
[Throws]
readonly attribute PluginArray plugins;
readonly attribute boolean pdfViewerEnabled;
};
// http://www.w3.org/TR/tracking-dnt/ sort of

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

@ -9,6 +9,7 @@
interface Plugin {
readonly attribute DOMString description;
readonly attribute DOMString filename;
readonly attribute DOMString version;
readonly attribute DOMString name;
readonly attribute unsigned long length;

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

@ -7,8 +7,13 @@
[LegacyUnenumerableNamedProperties,
Exposed=Window]
interface PluginArray {
void refresh();
[NeedsCallerType]
readonly attribute unsigned long length;
[NeedsCallerType]
getter Plugin? item(unsigned long index);
[NeedsCallerType]
getter Plugin? namedItem(DOMString name);
void refresh(optional boolean reloadDocuments = false);
};

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

@ -10800,15 +10800,6 @@
value: 5000
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "pdfjs."
#---------------------------------------------------------------------------
- name: pdfjs.disabled
type: bool
value: false
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "permissions."
#---------------------------------------------------------------------------

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

@ -64,7 +64,6 @@ pref_groups = [
"network",
"nglayout",
"page_load",
"pdfjs",
"permissions",
"plain_text",
"plugin",

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

@ -424,6 +424,12 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[OffscreenCanvasRenderingContext2D interface: operation roundRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double, sequence<(unrestricted double or DOMPointInit)>)]
expected: FAIL
[Navigator interface: attribute pdfViewerEnabled]
expected: FAIL
[Navigator interface: window.navigator must inherit property "pdfViewerEnabled" with the proper type]
expected: FAIL
[SVGElement interface: attribute oncontextlost]
expected: FAIL

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

@ -0,0 +1,3 @@
[plugins-and-mimetypes.html]
[navigator.pdfViewerEnabled exists]
expected: FAIL