Bug 1368950 - Remove URL Constructor with a URL base argument, r=qdot

This commit is contained in:
Andrea Marchesini 2017-05-31 21:18:19 +02:00
Родитель 4c5700d3ed
Коммит d7289f085d
3 изменённых файлов: 2 добавлений и 66 удалений

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

@ -60,10 +60,6 @@ CreateObjectURLInternal(const GlobalObject& aGlobal, T aObject,
class URLMainThread final : public URL
{
public:
static already_AddRefed<URLMainThread>
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
URL& aBase, ErrorResult& aRv);
static already_AddRefed<URLMainThread>
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
const Optional<nsAString>& aBase, ErrorResult& aRv);
@ -192,15 +188,6 @@ private:
nsCOMPtr<nsIURI> mURI;
};
/* static */ already_AddRefed<URLMainThread>
URLMainThread::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
URL& aBase, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
URLMainThread& base = static_cast<URLMainThread&>(aBase);
return Constructor(aGlobal.GetAsSupports(), aURL, base.GetURI(), aRv);
}
/* static */ already_AddRefed<URLMainThread>
URLMainThread::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
const Optional<nsAString>& aBase, ErrorResult& aRv)
@ -631,10 +618,6 @@ private:
class URLWorker final : public URL
{
public:
static already_AddRefed<URLWorker>
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
URL& aBase, ErrorResult& aRv);
static already_AddRefed<URLWorker>
Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
const Optional<nsAString>& aBase, ErrorResult& aRv);
@ -900,7 +883,6 @@ private:
const nsString mURL;
nsString mBase; // IsVoid() if we have no base URI string.
RefPtr<URLProxy> mBaseProxy;
RefPtr<URLProxy> mRetval;
@ -919,17 +901,6 @@ public:
mWorkerPrivate->AssertIsOnWorkerThread();
}
ConstructorRunnable(WorkerPrivate* aWorkerPrivate,
const nsAString& aURL, URLProxy* aBaseProxy)
: WorkerMainThreadRunnable(aWorkerPrivate,
NS_LITERAL_CSTRING("URL :: Constructor with BaseURL"))
, mURL(aURL)
, mBaseProxy(aBaseProxy)
{
mBase.SetIsVoid(true);
mWorkerPrivate->AssertIsOnWorkerThread();
}
bool
MainThreadRun()
{
@ -937,9 +908,7 @@ public:
ErrorResult rv;
RefPtr<URLMainThread> url;
if (mBaseProxy) {
url = URLMainThread::Constructor(nullptr, mURL, mBaseProxy->URI(), rv);
} else if (!mBase.IsVoid()) {
if (!mBase.IsVoid()) {
url = URLMainThread::Constructor(nullptr, mURL, mBase, rv);
} else {
url = URLMainThread::Constructor(nullptr, mURL, nullptr, rv);
@ -1215,22 +1184,6 @@ FinishConstructor(JSContext* aCx, WorkerPrivate* aPrivate,
return url.forget();
}
/* static */ already_AddRefed<URLWorker>
URLWorker::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
URL& aBase, ErrorResult& aRv)
{
MOZ_ASSERT(!NS_IsMainThread());
JSContext* cx = aGlobal.Context();
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
URLWorker& base = static_cast<URLWorker&>(aBase);
RefPtr<ConstructorRunnable> runnable =
new ConstructorRunnable(workerPrivate, aURL, base.GetURLProxy());
return FinishConstructor(cx, workerPrivate, runnable, aRv);
}
/* static */ already_AddRefed<URLWorker>
URLWorker::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
const Optional<nsAString>& aBase, ErrorResult& aRv)
@ -1653,17 +1606,6 @@ URL::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return URLBinding::Wrap(aCx, this, aGivenProto);
}
/* static */ already_AddRefed<URL>
URL::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
URL& aBase, ErrorResult& aRv)
{
if (NS_IsMainThread()) {
return URLMainThread::Constructor(aGlobal, aURL, aBase, aRv);
}
return URLWorker::Constructor(aGlobal, aURL, aBase, aRv);
}
/* static */ already_AddRefed<URL>
URL::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
const Optional<nsAString>& aBase, ErrorResult& aRv)

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

@ -47,10 +47,6 @@ public:
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
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 Optional<nsAString>& aBase, ErrorResult& aRv);

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

@ -12,9 +12,7 @@
* liability, trademark and document use rules apply.
*/
// [Constructor(DOMString url, optional (URL or DOMString) base = "about:blank")]
[Constructor(DOMString url, URL base),
Constructor(DOMString url, optional DOMString base),
[Constructor(USVString url, optional USVString base),
Exposed=(Window,Worker,WorkerDebugger)]
interface URL {
// Bug 824857: no support for stringifier attributes yet.