dom/workers/Location.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "Location.h"
     8 #include "mozilla/dom/WorkerLocationBinding.h"
    10 BEGIN_WORKERS_NAMESPACE
    12 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerLocation)
    14 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WorkerLocation, AddRef)
    15 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WorkerLocation, Release)
    17 /* static */ already_AddRefed<WorkerLocation>
    18 WorkerLocation::Create(WorkerPrivate::LocationInfo& aInfo)
    19 {
    20   nsRefPtr<WorkerLocation> location =
    21     new WorkerLocation(NS_ConvertUTF8toUTF16(aInfo.mHref),
    22                        NS_ConvertUTF8toUTF16(aInfo.mProtocol),
    23                        NS_ConvertUTF8toUTF16(aInfo.mHost),
    24                        NS_ConvertUTF8toUTF16(aInfo.mHostname),
    25                        NS_ConvertUTF8toUTF16(aInfo.mPort),
    26                        NS_ConvertUTF8toUTF16(aInfo.mPathname),
    27                        NS_ConvertUTF8toUTF16(aInfo.mSearch),
    28                        NS_ConvertUTF8toUTF16(aInfo.mHash),
    29                        aInfo.mOrigin);
    31   return location.forget();
    32 }
    34 JSObject*
    35 WorkerLocation::WrapObject(JSContext* aCx)
    36 {
    37   return WorkerLocationBinding_workers::Wrap(aCx, this);
    38 }
    40 END_WORKERS_NAMESPACE

mercurial