dom/base/nsMimeTypeArray.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 sw=2 et tw=79: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsMimeTypeArray_h___
michael@0 8 #define nsMimeTypeArray_h___
michael@0 9
michael@0 10 #include "nsString.h"
michael@0 11 #include "nsTArray.h"
michael@0 12 #include "nsWrapperCache.h"
michael@0 13 #include "nsAutoPtr.h"
michael@0 14 #include "nsPIDOMWindow.h"
michael@0 15
michael@0 16 class nsMimeType;
michael@0 17 class nsPluginElement;
michael@0 18
michael@0 19 class nsMimeTypeArray MOZ_FINAL : public nsISupports,
michael@0 20 public nsWrapperCache
michael@0 21 {
michael@0 22 public:
michael@0 23 nsMimeTypeArray(nsPIDOMWindow* aWindow);
michael@0 24 virtual ~nsMimeTypeArray();
michael@0 25
michael@0 26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 27 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsMimeTypeArray)
michael@0 28
michael@0 29 nsPIDOMWindow* GetParentObject() const;
michael@0 30 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
michael@0 31
michael@0 32 void Refresh();
michael@0 33
michael@0 34 // MimeTypeArray WebIDL methods
michael@0 35 nsMimeType* Item(uint32_t index);
michael@0 36 nsMimeType* NamedItem(const nsAString& name);
michael@0 37 nsMimeType* IndexedGetter(uint32_t index, bool &found);
michael@0 38 nsMimeType* NamedGetter(const nsAString& name, bool &found);
michael@0 39 bool NameIsEnumerable(const nsAString& name);
michael@0 40 uint32_t Length();
michael@0 41 void GetSupportedNames(unsigned, nsTArray< nsString >& retval);
michael@0 42
michael@0 43 protected:
michael@0 44 void EnsurePluginMimeTypes();
michael@0 45 void Clear();
michael@0 46
michael@0 47 nsCOMPtr<nsPIDOMWindow> mWindow;
michael@0 48
michael@0 49 // mMimeTypes contains MIME types handled by non-hidden plugins, those
michael@0 50 // popular plugins that must be exposed in navigator.plugins enumeration to
michael@0 51 // avoid breaking web content. Likewise, mMimeTypes are exposed in
michael@0 52 // navigator.mimeTypes enumeration.
michael@0 53 nsTArray<nsRefPtr<nsMimeType> > mMimeTypes;
michael@0 54
michael@0 55 // mHiddenMimeTypes contains MIME types handled by plugins hidden from
michael@0 56 // navigator.plugins enumeration or by an OS PreferredApplicationHandler.
michael@0 57 // mHiddenMimeTypes are hidden from navigator.mimeTypes enumeration.
michael@0 58 nsTArray<nsRefPtr<nsMimeType> > mHiddenMimeTypes;
michael@0 59 };
michael@0 60
michael@0 61 class nsMimeType MOZ_FINAL : public nsWrapperCache
michael@0 62 {
michael@0 63 public:
michael@0 64 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsMimeType)
michael@0 65 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType)
michael@0 66
michael@0 67 nsMimeType(nsPIDOMWindow* aWindow, nsPluginElement* aPluginElement,
michael@0 68 uint32_t aPluginTagMimeIndex, const nsAString& aMimeType);
michael@0 69 nsMimeType(nsPIDOMWindow* aWindow, const nsAString& aMimeType);
michael@0 70 virtual ~nsMimeType();
michael@0 71
michael@0 72 nsPIDOMWindow* GetParentObject() const;
michael@0 73 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
michael@0 74
michael@0 75 const nsString& Type() const
michael@0 76 {
michael@0 77 return mType;
michael@0 78 }
michael@0 79
michael@0 80 // MimeType WebIDL methods
michael@0 81 void GetDescription(nsString& retval) const;
michael@0 82 nsPluginElement *GetEnabledPlugin() const;
michael@0 83 void GetSuffixes(nsString& retval) const;
michael@0 84 void GetType(nsString& retval) const;
michael@0 85
michael@0 86 protected:
michael@0 87 nsCOMPtr<nsPIDOMWindow> mWindow;
michael@0 88
michael@0 89 // Strong reference to the active plugin, if any. Note that this
michael@0 90 // creates an explicit reference cycle through the plugin element's
michael@0 91 // mimetype array. We rely on the cycle collector to break this
michael@0 92 // cycle.
michael@0 93 nsRefPtr<nsPluginElement> mPluginElement;
michael@0 94 uint32_t mPluginTagMimeIndex;
michael@0 95 nsString mType;
michael@0 96 };
michael@0 97
michael@0 98 #endif /* nsMimeTypeArray_h___ */

mercurial