1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/workers/Location.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,114 @@ 1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozilla_dom_workers_location_h__ 1.10 +#define mozilla_dom_workers_location_h__ 1.11 + 1.12 +#include "Workers.h" 1.13 +#include "WorkerPrivate.h" 1.14 +#include "nsWrapperCache.h" 1.15 + 1.16 +BEGIN_WORKERS_NAMESPACE 1.17 + 1.18 +class WorkerLocation MOZ_FINAL : public nsWrapperCache 1.19 +{ 1.20 + nsString mHref; 1.21 + nsString mProtocol; 1.22 + nsString mHost; 1.23 + nsString mHostname; 1.24 + nsString mPort; 1.25 + nsString mPathname; 1.26 + nsString mSearch; 1.27 + nsString mHash; 1.28 + nsString mOrigin; 1.29 + 1.30 + WorkerLocation(const nsAString& aHref, 1.31 + const nsAString& aProtocol, 1.32 + const nsAString& aHost, 1.33 + const nsAString& aHostname, 1.34 + const nsAString& aPort, 1.35 + const nsAString& aPathname, 1.36 + const nsAString& aSearch, 1.37 + const nsAString& aHash, 1.38 + const nsAString& aOrigin) 1.39 + : mHref(aHref) 1.40 + , mProtocol(aProtocol) 1.41 + , mHost(aHost) 1.42 + , mHostname(aHostname) 1.43 + , mPort(aPort) 1.44 + , mPathname(aPathname) 1.45 + , mSearch(aSearch) 1.46 + , mHash(aHash) 1.47 + , mOrigin(aOrigin) 1.48 + { 1.49 + MOZ_COUNT_CTOR(WorkerLocation); 1.50 + SetIsDOMBinding(); 1.51 + } 1.52 + 1.53 +public: 1.54 + 1.55 + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation) 1.56 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation) 1.57 + 1.58 + static already_AddRefed<WorkerLocation> 1.59 + Create(WorkerPrivate::LocationInfo& aInfo); 1.60 + 1.61 + virtual JSObject* 1.62 + WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.63 + 1.64 + nsISupports* GetParentObject() const { 1.65 + return nullptr; 1.66 + } 1.67 + 1.68 + ~WorkerLocation() 1.69 + { 1.70 + MOZ_COUNT_DTOR(WorkerLocation); 1.71 + } 1.72 + 1.73 + void Stringify(nsString& aHref) const 1.74 + { 1.75 + aHref = mHref; 1.76 + } 1.77 + void GetHref(nsString& aHref) const 1.78 + { 1.79 + aHref = mHref; 1.80 + } 1.81 + void GetProtocol(nsString& aProtocol) const 1.82 + { 1.83 + aProtocol = mProtocol; 1.84 + } 1.85 + void GetHost(nsString& aHost) const 1.86 + { 1.87 + aHost = mHost; 1.88 + } 1.89 + void GetHostname(nsString& aHostname) const 1.90 + { 1.91 + aHostname = mHostname; 1.92 + } 1.93 + void GetPort(nsString& aPort) const 1.94 + { 1.95 + aPort = mPort; 1.96 + } 1.97 + void GetPathname(nsString& aPathname) const 1.98 + { 1.99 + aPathname = mPathname; 1.100 + } 1.101 + void GetSearch(nsString& aSearch) const 1.102 + { 1.103 + aSearch = mSearch; 1.104 + } 1.105 + void GetHash(nsString& aHash) const 1.106 + { 1.107 + aHash = mHash; 1.108 + } 1.109 + void GetOrigin(nsString& aOrigin) const 1.110 + { 1.111 + aOrigin = mOrigin; 1.112 + } 1.113 +}; 1.114 + 1.115 +END_WORKERS_NAMESPACE 1.116 + 1.117 +#endif // mozilla_dom_workers_location_h__