Sat, 03 Jan 2015 20:18:00 +0100
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.
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * url, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_workers_url_h__
8 #define mozilla_dom_workers_url_h__
10 #include "Workers.h"
12 #include "mozilla/ErrorResult.h"
13 #include "mozilla/dom/BindingDeclarations.h"
14 #include "mozilla/dom/URLSearchParams.h"
16 namespace mozilla {
17 namespace dom {
18 struct objectURLOptions;
19 }
20 }
22 BEGIN_WORKERS_NAMESPACE
24 class URLProxy;
26 class URL MOZ_FINAL : public mozilla::dom::URLSearchParamsObserver
27 {
28 typedef mozilla::dom::URLSearchParams URLSearchParams;
30 public:
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_CLASS(URL)
34 URL(WorkerPrivate* aWorkerPrivate, URLProxy* aURLProxy);
35 ~URL();
37 nsISupports*
38 GetParentObject() const
39 {
40 // There's only one global on a worker, so we don't need to specify.
41 return nullptr;
42 }
44 JSObject*
45 WrapObject(JSContext* aCx);
47 // Methods for WebIDL
49 static URL*
50 Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
51 URL& aBase, ErrorResult& aRv);
52 static URL*
53 Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
54 const nsAString& aBase, ErrorResult& aRv);
56 static void
57 CreateObjectURL(const GlobalObject& aGlobal,
58 JSObject* aArg, const objectURLOptions& aOptions,
59 nsString& aResult, ErrorResult& aRv);
61 static void
62 CreateObjectURL(const GlobalObject& aGlobal,
63 JSObject& aArg, const objectURLOptions& aOptions,
64 nsString& aResult, ErrorResult& aRv);
66 static void
67 RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aUrl);
69 void GetHref(nsString& aHref) const;
71 void SetHref(const nsAString& aHref, ErrorResult& aRv);
73 void GetOrigin(nsString& aOrigin) const;
75 void GetProtocol(nsString& aProtocol) const;
77 void SetProtocol(const nsAString& aProtocol);
79 void GetUsername(nsString& aUsername) const;
81 void SetUsername(const nsAString& aUsername);
83 void GetPassword(nsString& aPassword) const;
85 void SetPassword(const nsAString& aPassword);
87 void GetHost(nsString& aHost) const;
89 void SetHost(const nsAString& aHost);
91 void GetHostname(nsString& aHostname) const;
93 void SetHostname(const nsAString& aHostname);
95 void GetPort(nsString& aPort) const;
97 void SetPort(const nsAString& aPort);
99 void GetPathname(nsString& aPathname) const;
101 void SetPathname(const nsAString& aPathname);
103 void GetSearch(nsString& aSearch) const;
105 void SetSearch(const nsAString& aSearch);
107 URLSearchParams* SearchParams();
109 void SetSearchParams(URLSearchParams& aSearchParams);
111 void GetHash(nsString& aHost) const;
113 void SetHash(const nsAString& aHash);
115 void Stringify(nsString& aRetval) const
116 {
117 GetHref(aRetval);
118 }
120 // IURLSearchParamsObserver
121 void URLSearchParamsUpdated() MOZ_OVERRIDE;
123 private:
124 URLProxy* GetURLProxy() const
125 {
126 return mURLProxy;
127 }
129 void CreateSearchParamsIfNeeded();
131 void SetSearchInternal(const nsAString& aSearch);
133 void UpdateURLSearchParams();
135 WorkerPrivate* mWorkerPrivate;
136 nsRefPtr<URLProxy> mURLProxy;
137 nsRefPtr<URLSearchParams> mSearchParams;
138 };
140 END_WORKERS_NAMESPACE
142 #endif /* mozilla_dom_workers_url_h__ */