2013-01-28 15:08:21 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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 URL_h___
|
|
|
|
#define URL_h___
|
|
|
|
|
2013-09-04 21:07:21 +04:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2013-08-15 22:17:48 +04:00
|
|
|
#include "nsString.h"
|
2013-01-28 15:08:21 +04:00
|
|
|
|
|
|
|
class nsIDOMBlob;
|
2013-08-15 22:17:48 +04:00
|
|
|
class nsISupports;
|
2013-09-04 21:07:21 +04:00
|
|
|
class nsIURI;
|
|
|
|
class nsPIDOMWindow;
|
2013-01-28 15:08:21 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-02-15 12:04:11 +04:00
|
|
|
|
2013-08-15 22:17:48 +04:00
|
|
|
class ErrorResult;
|
2013-02-15 12:04:11 +04:00
|
|
|
class DOMMediaStream;
|
|
|
|
|
2013-01-28 15:08:21 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2013-06-21 07:15:15 +04:00
|
|
|
class MediaSource;
|
2013-08-15 22:17:48 +04:00
|
|
|
class GlobalObject;
|
|
|
|
struct objectURLOptions;
|
2013-06-21 07:15:15 +04:00
|
|
|
|
2013-09-04 21:07:34 +04:00
|
|
|
namespace workers {
|
|
|
|
class URLProxy;
|
|
|
|
}
|
|
|
|
|
2013-01-28 15:08:21 +04:00
|
|
|
class URL MOZ_FINAL
|
|
|
|
{
|
|
|
|
public:
|
2013-09-04 21:07:21 +04:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(URL)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(URL)
|
|
|
|
|
|
|
|
URL(nsPIDOMWindow* aWindow, nsIURI* aURI);
|
|
|
|
|
2013-01-28 15:08:21 +04:00
|
|
|
// WebIDL methods
|
2013-09-04 21:07:21 +04:00
|
|
|
nsPIDOMWindow* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
|
|
|
|
|
|
|
|
static already_AddRefed<URL>
|
|
|
|
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
|
|
|
URL& aBase, ErrorResult& aRv);
|
|
|
|
static already_AddRefed<URL>
|
|
|
|
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
|
|
|
const nsAString& aBase, ErrorResult& aRv);
|
|
|
|
|
2013-08-23 09:17:08 +04:00
|
|
|
static void CreateObjectURL(const GlobalObject& aGlobal,
|
|
|
|
nsIDOMBlob* aBlob,
|
2013-01-28 15:08:21 +04:00
|
|
|
const objectURLOptions& aOptions,
|
2012-12-03 20:07:49 +04:00
|
|
|
nsString& aResult,
|
2013-01-28 15:08:21 +04:00
|
|
|
ErrorResult& aError);
|
2012-12-03 20:07:49 +04:00
|
|
|
static void CreateObjectURL(const GlobalObject& aGlobal,
|
2013-02-15 12:04:11 +04:00
|
|
|
DOMMediaStream& aStream,
|
2013-09-04 21:07:21 +04:00
|
|
|
const objectURLOptions& aOptions,
|
2012-12-03 20:07:49 +04:00
|
|
|
nsString& aResult,
|
2013-09-04 21:07:21 +04:00
|
|
|
ErrorResult& aError);
|
2013-06-21 07:15:15 +04:00
|
|
|
static void CreateObjectURL(const GlobalObject& aGlobal,
|
|
|
|
MediaSource& aSource,
|
|
|
|
const objectURLOptions& aOptions,
|
|
|
|
nsString& aResult,
|
2013-09-04 21:07:21 +04:00
|
|
|
ErrorResult& aError);
|
2012-12-03 20:07:49 +04:00
|
|
|
static void RevokeObjectURL(const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aURL);
|
2013-01-28 15:08:21 +04:00
|
|
|
|
2013-09-04 21:07:21 +04:00
|
|
|
void GetHref(nsString& aHref) const;
|
|
|
|
|
|
|
|
void SetHref(const nsAString& aHref, ErrorResult& aRv);
|
|
|
|
|
|
|
|
void GetOrigin(nsString& aOrigin) const;
|
|
|
|
|
|
|
|
void GetProtocol(nsString& aProtocol) const;
|
|
|
|
|
|
|
|
void SetProtocol(const nsAString& aProtocol);
|
|
|
|
|
|
|
|
void GetUsername(nsString& aUsername) const;
|
|
|
|
|
|
|
|
void SetUsername(const nsAString& aUsername);
|
|
|
|
|
|
|
|
void GetPassword(nsString& aPassword) const;
|
|
|
|
|
|
|
|
void SetPassword(const nsAString& aPassword);
|
|
|
|
|
|
|
|
void GetHost(nsString& aHost) const;
|
|
|
|
|
|
|
|
void SetHost(const nsAString& aHost);
|
|
|
|
|
|
|
|
void GetHostname(nsString& aHostname) const;
|
|
|
|
|
|
|
|
void SetHostname(const nsAString& aHostname);
|
|
|
|
|
|
|
|
void GetPort(nsString& aPort) const;
|
|
|
|
|
|
|
|
void SetPort(const nsAString& aPort);
|
|
|
|
|
|
|
|
void GetPathname(nsString& aPathname) const;
|
|
|
|
|
|
|
|
void SetPathname(const nsAString& aPathname);
|
|
|
|
|
|
|
|
void GetSearch(nsString& aRetval) const;
|
|
|
|
|
|
|
|
void SetSearch(const nsAString& aArg);
|
|
|
|
|
|
|
|
void GetHash(nsString& aRetval) const;
|
|
|
|
|
|
|
|
void SetHash(const nsAString& aArg);
|
|
|
|
|
2013-01-28 15:08:21 +04:00
|
|
|
private:
|
2013-09-04 21:07:21 +04:00
|
|
|
nsIURI* GetURI() const
|
|
|
|
{
|
|
|
|
return mURI;
|
|
|
|
}
|
|
|
|
|
2013-01-28 15:08:21 +04:00
|
|
|
static void CreateObjectURLInternal(nsISupports* aGlobal, nsISupports* aObject,
|
|
|
|
const nsACString& aScheme,
|
2013-09-04 21:07:21 +04:00
|
|
|
const objectURLOptions& aOptions,
|
2012-12-03 20:07:49 +04:00
|
|
|
nsString& aResult,
|
2013-09-04 21:07:21 +04:00
|
|
|
ErrorResult& aError);
|
|
|
|
|
|
|
|
nsRefPtr<nsPIDOMWindow> mWindow;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
2013-09-04 21:07:34 +04:00
|
|
|
|
|
|
|
friend class mozilla::dom::workers::URLProxy;
|
2013-01-28 15:08:21 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* URL_h___ */
|