mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-29 18:47:31 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
29201b8059
74 changed files with 489 additions and 5132 deletions
|
|
@ -1585,19 +1585,30 @@ BrowserGlue.prototype = {
|
||||||
const SMART_BOOKMARKS_VERSION = 4;
|
const SMART_BOOKMARKS_VERSION = 4;
|
||||||
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
|
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
|
||||||
const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
|
const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
|
||||||
|
const SMART_BOOKMARKS_MAX_PREF = "browser.places.smartBookmarks.max";
|
||||||
|
const SMART_BOOKMARKS_OLDMAX_PREF = "browser.places.smartBookmarks.old-max";
|
||||||
|
|
||||||
// TODO bug 399268: should this be a pref?
|
const MAX_RESULTS = Services.prefs.getIntPref(SMART_BOOKMARKS_MAX_PREF, 10);
|
||||||
const MAX_RESULTS = 10;
|
let OLD_MAX_RESULTS = Services.prefs.getIntPref(SMART_BOOKMARKS_OLDMAX_PREF, 10);
|
||||||
|
|
||||||
// Get current smart bookmarks version. If not set, create them.
|
// Get current smart bookmarks version. If not set, create them.
|
||||||
let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0);
|
let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0);
|
||||||
|
|
||||||
// If version is current or smart bookmarks are disabled, just bail out.
|
// If version is current and max hasn't changed or smart bookmarks are disabled, just bail out.
|
||||||
if (smartBookmarksCurrentVersion == -1 ||
|
if (smartBookmarksCurrentVersion == -1 ||
|
||||||
smartBookmarksCurrentVersion >= SMART_BOOKMARKS_VERSION) {
|
(smartBookmarksCurrentVersion >= SMART_BOOKMARKS_VERSION &&
|
||||||
|
OLD_MAX_RESULTS == MAX_RESULTS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We're going to recreate the smart bookmarks and set the current max, so store it.
|
||||||
|
if (Services.prefs.prefHasUserValue(SMART_BOOKMARKS_MAX_PREF)) {
|
||||||
|
Services.prefs.setIntPref(SMART_BOOKMARKS_OLDMAX_PREF, MAX_RESULTS);
|
||||||
|
} else {
|
||||||
|
// The max value is default, no need to track the temp value.
|
||||||
|
Services.prefs.clearUserPref(SMART_BOOKMARKS_OLDMAX_PREF);
|
||||||
|
}
|
||||||
|
|
||||||
let batch = {
|
let batch = {
|
||||||
runBatched: function BG_EPDQI_runBatched() {
|
runBatched: function BG_EPDQI_runBatched() {
|
||||||
let menuIndex = 0;
|
let menuIndex = 0;
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,6 @@
|
||||||
#include "mozilla/dom/PowerManager.h"
|
#include "mozilla/dom/PowerManager.h"
|
||||||
#include "mozilla/dom/WakeLock.h"
|
#include "mozilla/dom/WakeLock.h"
|
||||||
#include "mozilla/dom/power/PowerManagerService.h"
|
#include "mozilla/dom/power/PowerManagerService.h"
|
||||||
#include "mozilla/dom/FlyWebPublishedServer.h"
|
|
||||||
#include "mozilla/dom/FlyWebService.h"
|
|
||||||
#include "mozilla/dom/Permissions.h"
|
#include "mozilla/dom/Permissions.h"
|
||||||
#include "mozilla/dom/ServiceWorkerContainer.h"
|
#include "mozilla/dom/ServiceWorkerContainer.h"
|
||||||
#include "mozilla/dom/StorageManager.h"
|
#include "mozilla/dom/StorageManager.h"
|
||||||
|
|
@ -1356,41 +1354,6 @@ Navigator::GetBattery(ErrorResult& aRv)
|
||||||
return mBatteryPromise;
|
return mBatteryPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Promise>
|
|
||||||
Navigator::PublishServer(const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
RefPtr<FlyWebService> service = FlyWebService::GetOrCreate();
|
|
||||||
if (!service) {
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<FlyWebPublishPromise> mozPromise =
|
|
||||||
service->PublishServer(aName, aOptions, mWindow);
|
|
||||||
MOZ_ASSERT(mozPromise);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
|
|
||||||
ErrorResult result;
|
|
||||||
RefPtr<Promise> domPromise = Promise::Create(global, result);
|
|
||||||
if (result.Failed()) {
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
mozPromise->Then(AbstractThread::MainThread(),
|
|
||||||
__func__,
|
|
||||||
[domPromise] (FlyWebPublishedServer* aServer) {
|
|
||||||
domPromise->MaybeResolve(aServer);
|
|
||||||
},
|
|
||||||
[domPromise] (nsresult aStatus) {
|
|
||||||
domPromise->MaybeReject(aStatus);
|
|
||||||
});
|
|
||||||
|
|
||||||
return domPromise.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
PowerManager*
|
PowerManager*
|
||||||
Navigator::GetMozPower(ErrorResult& aRv)
|
Navigator::GetMozPower(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ class WakeLock;
|
||||||
class ArrayBufferViewOrBlobOrStringOrFormData;
|
class ArrayBufferViewOrBlobOrStringOrFormData;
|
||||||
class ServiceWorkerContainer;
|
class ServiceWorkerContainer;
|
||||||
class DOMRequest;
|
class DOMRequest;
|
||||||
struct FlyWebPublishOptions;
|
|
||||||
struct FlyWebFilter;
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|
@ -140,9 +138,6 @@ public:
|
||||||
Geolocation* GetGeolocation(ErrorResult& aRv);
|
Geolocation* GetGeolocation(ErrorResult& aRv);
|
||||||
Promise* GetBattery(ErrorResult& aRv);
|
Promise* GetBattery(ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<Promise> PublishServer(const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);
|
static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);
|
||||||
|
|
||||||
static nsresult GetPlatform(nsAString& aPlatform,
|
static nsresult GetPlatform(nsAString& aPlatform,
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,6 @@
|
||||||
#include "mozilla/dom/HTMLIFrameElement.h"
|
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||||
#include "mozilla/dom/HTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "mozilla/dom/MediaSource.h"
|
#include "mozilla/dom/MediaSource.h"
|
||||||
#include "mozilla/dom/FlyWebService.h"
|
|
||||||
|
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
|
|
@ -8453,13 +8452,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't save presentation if there are active FlyWeb connections or FlyWeb
|
|
||||||
// servers.
|
|
||||||
FlyWebService* flyWebService = FlyWebService::GetExisting();
|
|
||||||
if (flyWebService && flyWebService->HasConnectionOrServer(win->WindowID())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mSubDocuments) {
|
if (mSubDocuments) {
|
||||||
for (auto iter = mSubDocuments->Iter(); !iter.Done(); iter.Next()) {
|
for (auto iter = mSubDocuments->Iter(); !iter.Done(); iter.Next()) {
|
||||||
auto entry = static_cast<SubDocMapEntry*>(iter.Get());
|
auto entry = static_cast<SubDocMapEntry*>(iter.Get());
|
||||||
|
|
|
||||||
|
|
@ -340,14 +340,6 @@ DOMInterfaces = {
|
||||||
'wrapperCache': False,
|
'wrapperCache': False,
|
||||||
},
|
},
|
||||||
|
|
||||||
'FlyWebFetchEvent': {
|
|
||||||
'headerFile': 'FlyWebServerEvents.h',
|
|
||||||
},
|
|
||||||
|
|
||||||
'FlyWebWebSocketEvent': {
|
|
||||||
'headerFile': 'FlyWebServerEvents.h',
|
|
||||||
},
|
|
||||||
|
|
||||||
'FontFaceSet': {
|
'FontFaceSet': {
|
||||||
'implicitJSContext': [ 'load' ],
|
'implicitJSContext': [ 'load' ],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -139,10 +139,6 @@ const kEventConstructors = {
|
||||||
return new ErrorEvent(aName, aProps);
|
return new ErrorEvent(aName, aProps);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FlyWebFetchEvent: { create: null, // Cannot create untrusted event from JS.
|
|
||||||
},
|
|
||||||
FlyWebWebSocketEvent: { create: null, // Cannot create untrusted event from JS.
|
|
||||||
},
|
|
||||||
FocusEvent: { create: function (aName, aProps) {
|
FocusEvent: { create: function (aName, aProps) {
|
||||||
return new FocusEvent(aName, aProps);
|
return new FocusEvent(aName, aProps);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsTHashtable.h"
|
|
||||||
#include "nsClassHashtable.h"
|
|
||||||
#include "nsIUUIDGenerator.h"
|
|
||||||
#include "jsapi.h"
|
|
||||||
#include "mozilla/StaticPtr.h"
|
|
||||||
#include "mozilla/Logging.h"
|
|
||||||
#include "nsComponentManagerUtils.h"
|
|
||||||
#include "nsServiceManagerUtils.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/FlyWebDiscoveryManager.h"
|
|
||||||
#include "mozilla/dom/FlyWebDiscoveryManagerBinding.h"
|
|
||||||
#include "mozilla/dom/Element.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
static LazyLogModule gFlyWebDiscoveryManagerLog("FlyWebDiscoveryManager");
|
|
||||||
#undef LOG_I
|
|
||||||
#define LOG_I(...) MOZ_LOG(mozilla::dom::gFlyWebDiscoveryManagerLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
|
|
||||||
#undef LOG_E
|
|
||||||
#define LOG_E(...) MOZ_LOG(mozilla::dom::gFlyWebDiscoveryManagerLog, mozilla::LogLevel::Error, (__VA_ARGS__))
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(FlyWebDiscoveryManager)
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(FlyWebDiscoveryManager)
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(FlyWebDiscoveryManager)
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FlyWebDiscoveryManager)
|
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
FlyWebDiscoveryManager::FlyWebDiscoveryManager(nsISupports* aParent,
|
|
||||||
FlyWebService* aService)
|
|
||||||
: mParent(aParent)
|
|
||||||
, mService(aService)
|
|
||||||
, mNextId(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FlyWebDiscoveryManager::~FlyWebDiscoveryManager()
|
|
||||||
{
|
|
||||||
mService->UnregisterDiscoveryManager(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject*
|
|
||||||
FlyWebDiscoveryManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
||||||
{
|
|
||||||
return FlyWebDiscoveryManagerBinding::Wrap(aCx, this, aGivenProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsISupports*
|
|
||||||
FlyWebDiscoveryManager::GetParentObject() const
|
|
||||||
{
|
|
||||||
return mParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ already_AddRefed<FlyWebDiscoveryManager>
|
|
||||||
FlyWebDiscoveryManager::Constructor(const GlobalObject& aGlobal, ErrorResult& rv)
|
|
||||||
{
|
|
||||||
RefPtr<FlyWebService> service = FlyWebService::GetOrCreate();
|
|
||||||
if (!service) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<FlyWebDiscoveryManager> result = new FlyWebDiscoveryManager(
|
|
||||||
aGlobal.GetAsSupports(), service);
|
|
||||||
return result.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebDiscoveryManager::ListServices(nsTArray<FlyWebDiscoveredService>& aServices)
|
|
||||||
{
|
|
||||||
return mService->ListDiscoveredServices(aServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
FlyWebDiscoveryManager::StartDiscovery(FlyWebDiscoveryCallback& aCallback)
|
|
||||||
{
|
|
||||||
uint32_t id = GenerateId();
|
|
||||||
mCallbackMap.Put(id, &aCallback);
|
|
||||||
mService->RegisterDiscoveryManager(this);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebDiscoveryManager::StopDiscovery(uint32_t aId)
|
|
||||||
{
|
|
||||||
mCallbackMap.Remove(aId);
|
|
||||||
if (mCallbackMap.Count() == 0) {
|
|
||||||
mService->UnregisterDiscoveryManager(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebDiscoveryManager::PairWithService(const nsAString& aServiceId,
|
|
||||||
FlyWebPairingCallback& aCallback)
|
|
||||||
{
|
|
||||||
mService->PairWithService(aServiceId, aCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebDiscoveryManager::NotifyDiscoveredServicesChanged()
|
|
||||||
{
|
|
||||||
nsTArray<FlyWebDiscoveredService> services;
|
|
||||||
ListServices(services);
|
|
||||||
Sequence<FlyWebDiscoveredService> servicesSeq;
|
|
||||||
servicesSeq.SwapElements(services);
|
|
||||||
for (auto iter = mCallbackMap.Iter(); !iter.Done(); iter.Next()) {
|
|
||||||
FlyWebDiscoveryCallback *callback = iter.UserData();
|
|
||||||
ErrorResult err;
|
|
||||||
callback->OnDiscoveredServicesChanged(servicesSeq, err);
|
|
||||||
ENSURE_SUCCESS_VOID(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_FlyWebDiscoveryManager_h
|
|
||||||
#define mozilla_dom_FlyWebDiscoveryManager_h
|
|
||||||
|
|
||||||
#include "nsISupportsImpl.h"
|
|
||||||
#include "mozilla/ErrorResult.h"
|
|
||||||
#include "nsRefPtrHashtable.h"
|
|
||||||
#include "nsWrapperCache.h"
|
|
||||||
#include "FlyWebDiscoveryManagerBinding.h"
|
|
||||||
#include "FlyWebService.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class FlyWebDiscoveryManager final : public nsISupports
|
|
||||||
, public nsWrapperCache
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FlyWebDiscoveryManager)
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
||||||
nsISupports* GetParentObject() const;
|
|
||||||
|
|
||||||
static already_AddRefed<FlyWebDiscoveryManager> Constructor(const GlobalObject& aGlobal,
|
|
||||||
ErrorResult& rv);
|
|
||||||
|
|
||||||
void ListServices(nsTArray<FlyWebDiscoveredService>& aServices);
|
|
||||||
uint32_t StartDiscovery(FlyWebDiscoveryCallback& aCallback);
|
|
||||||
void StopDiscovery(uint32_t aId);
|
|
||||||
|
|
||||||
void PairWithService(const nsAString& aServiceId,
|
|
||||||
FlyWebPairingCallback& callback);
|
|
||||||
|
|
||||||
void NotifyDiscoveredServicesChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
FlyWebDiscoveryManager(nsISupports* mParent, FlyWebService* aService);
|
|
||||||
~FlyWebDiscoveryManager();
|
|
||||||
|
|
||||||
uint32_t GenerateId() {
|
|
||||||
return ++mNextId;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> mParent;
|
|
||||||
RefPtr<FlyWebService> mService;
|
|
||||||
|
|
||||||
uint32_t mNextId;
|
|
||||||
|
|
||||||
nsRefPtrHashtable<nsUint32HashKey, FlyWebDiscoveryCallback> mCallbackMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebDiscoveryManager_h
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_FlyWebPublishOptionsIPCSerialiser_h
|
|
||||||
#define mozilla_dom_FlyWebPublishOptionsIPCSerialiser_h
|
|
||||||
|
|
||||||
#include "mozilla/dom/FlyWebPublishBinding.h"
|
|
||||||
|
|
||||||
namespace IPC {
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct ParamTraits<mozilla::dom::FlyWebPublishOptions>
|
|
||||||
{
|
|
||||||
typedef mozilla::dom::FlyWebPublishOptions paramType;
|
|
||||||
|
|
||||||
// Function to serialize a FlyWebPublishOptions
|
|
||||||
static void Write(Message *aMsg, const paramType& aParam)
|
|
||||||
{
|
|
||||||
WriteParam(aMsg, aParam.mUiUrl);
|
|
||||||
}
|
|
||||||
// Function to de-serialize a FlyWebPublishOptions
|
|
||||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
|
||||||
{
|
|
||||||
return ReadParam(aMsg, aIter, &(aResult->mUiUrl));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebPublishOptionsIPCSerialiser_h
|
|
||||||
|
|
@ -1,675 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "mozilla/dom/FlyWebPublishedServerIPC.h"
|
|
||||||
#include "mozilla/dom/FlyWebPublishBinding.h"
|
|
||||||
#include "mozilla/dom/FlyWebService.h"
|
|
||||||
#include "mozilla/dom/Request.h"
|
|
||||||
#include "mozilla/dom/FlyWebServerEvents.h"
|
|
||||||
#include "mozilla/dom/ContentChild.h"
|
|
||||||
#include "mozilla/dom/ContentParent.h"
|
|
||||||
#include "mozilla/dom/InternalResponse.h"
|
|
||||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
|
||||||
#include "mozilla/net/NeckoParent.h"
|
|
||||||
#include "mozilla/net/IPCTransportProvider.h"
|
|
||||||
#include "mozilla/ErrorResult.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "mozilla/Unused.h"
|
|
||||||
#include "nsCharSeparatedTokenizer.h"
|
|
||||||
#include "nsGlobalWindow.h"
|
|
||||||
#include "WebSocketChannel.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
static LazyLogModule gFlyWebPublishedServerLog("FlyWebPublishedServer");
|
|
||||||
#undef LOG_I
|
|
||||||
#define LOG_I(...) MOZ_LOG(mozilla::dom::gFlyWebPublishedServerLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
|
|
||||||
#undef LOG_E
|
|
||||||
#define LOG_E(...) MOZ_LOG(mozilla::dom::gFlyWebPublishedServerLog, mozilla::LogLevel::Error, (__VA_ARGS__))
|
|
||||||
|
|
||||||
/******** FlyWebPublishedServer ********/
|
|
||||||
|
|
||||||
FlyWebPublishedServer::FlyWebPublishedServer(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions)
|
|
||||||
: mozilla::DOMEventTargetHelper(aOwner)
|
|
||||||
, mOwnerWindowID(aOwner ? aOwner->WindowID() : 0)
|
|
||||||
, mName(aName)
|
|
||||||
, mUiUrl(aOptions.mUiUrl)
|
|
||||||
, mIsRegistered(true) // Registered by the FlyWebService
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServer::LastRelease()
|
|
||||||
{
|
|
||||||
// Make sure to unregister to avoid dangling pointers. Use the LastRelease
|
|
||||||
// hook rather than dtor since calling virtual functions during dtor
|
|
||||||
// wouldn't do what we want. Also, LastRelease is called earlier than dtor
|
|
||||||
// for CC objects.
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject*
|
|
||||||
FlyWebPublishedServer::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
||||||
{
|
|
||||||
return FlyWebPublishedServerBinding::Wrap(aCx, this, aGivenProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServer::Close()
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServer::Close(%p)", this);
|
|
||||||
|
|
||||||
// Unregister from server.
|
|
||||||
if (mIsRegistered) {
|
|
||||||
MOZ_ASSERT(FlyWebService::GetExisting());
|
|
||||||
FlyWebService::GetExisting()->UnregisterServer(this);
|
|
||||||
mIsRegistered = false;
|
|
||||||
|
|
||||||
DispatchTrustedEvent(NS_LITERAL_STRING("close"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServer::FireFetchEvent(InternalRequest* aRequest)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
|
|
||||||
RefPtr<FlyWebFetchEvent> e = new FlyWebFetchEvent(this,
|
|
||||||
new Request(global, aRequest),
|
|
||||||
aRequest);
|
|
||||||
e->Init(this);
|
|
||||||
e->InitEvent(NS_LITERAL_STRING("fetch"), false, false);
|
|
||||||
|
|
||||||
DispatchTrustedEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServer::FireWebsocketEvent(InternalRequest* aConnectRequest)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
|
|
||||||
RefPtr<FlyWebFetchEvent> e = new FlyWebWebSocketEvent(this,
|
|
||||||
new Request(global, aConnectRequest),
|
|
||||||
aConnectRequest);
|
|
||||||
e->Init(this);
|
|
||||||
e->InitEvent(NS_LITERAL_STRING("websocket"), false, false);
|
|
||||||
|
|
||||||
DispatchTrustedEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServer::PublishedServerStarted(nsresult aStatus)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServer::PublishedServerStarted(%p)", this);
|
|
||||||
|
|
||||||
RefPtr<FlyWebPublishPromise> promise = mPublishPromise.Ensure(__func__);
|
|
||||||
if (NS_SUCCEEDED(aStatus)) {
|
|
||||||
mPublishPromise.Resolve(this, __func__);
|
|
||||||
} else {
|
|
||||||
Close();
|
|
||||||
mPublishPromise.Reject(aStatus, __func__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<WebSocket>
|
|
||||||
FlyWebPublishedServer::OnWebSocketAccept(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aConnectRequest);
|
|
||||||
|
|
||||||
LOG_I("FlyWebPublishedServer::OnWebSocketAccept(%p)", this);
|
|
||||||
|
|
||||||
nsCOMPtr<nsITransportProvider> provider =
|
|
||||||
OnWebSocketAcceptInternal(aConnectRequest,
|
|
||||||
aProtocol,
|
|
||||||
aRv);
|
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
MOZ_ASSERT(provider);
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(GetOwner());
|
|
||||||
AutoJSContext cx;
|
|
||||||
GlobalObject global(cx, nsGlobalWindow::Cast(window)->FastGetGlobalJSObject());
|
|
||||||
|
|
||||||
nsAutoCString extensions, negotiatedExtensions;
|
|
||||||
aConnectRequest->Headers()->
|
|
||||||
GetFirst(NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"), extensions, aRv);
|
|
||||||
mozilla::net::ProcessServerWebSocketExtensions(extensions,
|
|
||||||
negotiatedExtensions);
|
|
||||||
|
|
||||||
nsCString url;
|
|
||||||
aConnectRequest->GetURL(url);
|
|
||||||
Sequence<nsString> protocols;
|
|
||||||
if (aProtocol.WasPassed() &&
|
|
||||||
!protocols.AppendElement(aProtocol.Value(), fallible)) {
|
|
||||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WebSocket::ConstructorCommon(global,
|
|
||||||
NS_ConvertUTF8toUTF16(url),
|
|
||||||
protocols,
|
|
||||||
provider,
|
|
||||||
negotiatedExtensions,
|
|
||||||
aRv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******** FlyWebPublishedServerImpl ********/
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED0(FlyWebPublishedServerImpl, mozilla::DOMEventTargetHelper)
|
|
||||||
|
|
||||||
FlyWebPublishedServerImpl::FlyWebPublishedServerImpl(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions)
|
|
||||||
: FlyWebPublishedServer(aOwner, aName, aOptions)
|
|
||||||
, mHttpServer(new HttpServer())
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerImpl::FlyWebPublishedServerImpl(%p)", this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerImpl::PermissionGranted(bool aGranted)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerImpl::PermissionGranted(%b)", aGranted);
|
|
||||||
if (!aGranted) {
|
|
||||||
PublishedServerStarted(NS_ERROR_FAILURE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mHttpServer->Init(-1, Preferences::GetBool("flyweb.use-tls", false), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerImpl::Close()
|
|
||||||
{
|
|
||||||
FlyWebPublishedServer::Close();
|
|
||||||
|
|
||||||
if (mMDNSCancelRegister) {
|
|
||||||
mMDNSCancelRegister->Cancel(NS_BINDING_ABORTED);
|
|
||||||
mMDNSCancelRegister = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mHttpServer) {
|
|
||||||
RefPtr<HttpServer> server = mHttpServer.forget();
|
|
||||||
server->Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerImpl::OnServerStarted(nsresult aStatus)
|
|
||||||
{
|
|
||||||
if (NS_SUCCEEDED(aStatus)) {
|
|
||||||
FlyWebService::GetOrCreate()->StartDiscoveryOf(this);
|
|
||||||
} else {
|
|
||||||
PublishedServerStarted(aStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerImpl::OnFetchResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aRequest);
|
|
||||||
MOZ_ASSERT(aResponse);
|
|
||||||
|
|
||||||
LOG_I("FlyWebPublishedServerImpl::OnFetchResponse(%p)", this);
|
|
||||||
|
|
||||||
if (mHttpServer) {
|
|
||||||
mHttpServer->SendResponse(aRequest, aResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerImpl::OnWebSocketResponse(InternalRequest* aConnectRequest,
|
|
||||||
InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aConnectRequest);
|
|
||||||
MOZ_ASSERT(aResponse);
|
|
||||||
|
|
||||||
LOG_I("FlyWebPublishedMDNSServer::OnWebSocketResponse(%p)", this);
|
|
||||||
|
|
||||||
if (mHttpServer) {
|
|
||||||
mHttpServer->SendWebSocketResponse(aConnectRequest, aResponse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsITransportProvider>
|
|
||||||
FlyWebPublishedServerImpl::OnWebSocketAcceptInternal(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerImpl::OnWebSocketAcceptInternal(%p)", this);
|
|
||||||
|
|
||||||
if (!mHttpServer) {
|
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mHttpServer->AcceptWebSocket(aConnectRequest,
|
|
||||||
aProtocol,
|
|
||||||
aRv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******** FlyWebPublishedServerChild ********/
|
|
||||||
|
|
||||||
FlyWebPublishedServerChild::FlyWebPublishedServerChild(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions)
|
|
||||||
: FlyWebPublishedServer(aOwner, aName, aOptions)
|
|
||||||
, mActorExists(false)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::FlyWebPublishedServerChild(%p)", this);
|
|
||||||
|
|
||||||
// The matching release happens when the actor is destroyed, in
|
|
||||||
// ContentChild::DeallocPFlyWebPublishedServerChild
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerChild::PermissionGranted(bool aGranted)
|
|
||||||
{
|
|
||||||
if (!aGranted) {
|
|
||||||
PublishedServerStarted(NS_ERROR_FAILURE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mActorExists = true;
|
|
||||||
FlyWebPublishOptions options;
|
|
||||||
options.mUiUrl = mUiUrl;
|
|
||||||
|
|
||||||
// Proceed with initialization.
|
|
||||||
ContentChild::GetSingleton()->
|
|
||||||
SendPFlyWebPublishedServerConstructor(this, mName, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerChild::RecvServerReady(const nsresult& aStatus)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::RecvServerReady(%p)", this);
|
|
||||||
MOZ_ASSERT(mActorExists);
|
|
||||||
|
|
||||||
PublishedServerStarted(aStatus);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerChild::RecvServerClose()
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::RecvServerClose(%p)", this);
|
|
||||||
MOZ_ASSERT(mActorExists);
|
|
||||||
|
|
||||||
Close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerChild::RecvFetchRequest(const IPCInternalRequest& aRequest,
|
|
||||||
const uint64_t& aRequestId)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::RecvFetchRequest(%p)", this);
|
|
||||||
MOZ_ASSERT(mActorExists);
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> request = new InternalRequest(aRequest);
|
|
||||||
mPendingRequests.Put(request, aRequestId);
|
|
||||||
FireFetchEvent(request);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerChild::RecvWebSocketRequest(const IPCInternalRequest& aRequest,
|
|
||||||
const uint64_t& aRequestId,
|
|
||||||
PTransportProviderChild* aProvider)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::RecvWebSocketRequest(%p)", this);
|
|
||||||
MOZ_ASSERT(mActorExists);
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> request = new InternalRequest(aRequest);
|
|
||||||
mPendingRequests.Put(request, aRequestId);
|
|
||||||
|
|
||||||
// Not addreffing here. The addref was already done when the
|
|
||||||
// PTransportProvider child constructor original ran.
|
|
||||||
mPendingTransportProviders.Put(aRequestId,
|
|
||||||
dont_AddRef(static_cast<TransportProviderChild*>(aProvider)));
|
|
||||||
|
|
||||||
FireWebsocketEvent(request);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerChild::ActorDestroy(ActorDestroyReason aWhy)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::ActorDestroy(%p)", this);
|
|
||||||
|
|
||||||
mActorExists = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerChild::OnFetchResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnFetchResponse(%p)", this);
|
|
||||||
|
|
||||||
if (!mActorExists) {
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnFetchResponse(%p) - No actor!", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t id = mPendingRequests.Get(aRequest);
|
|
||||||
MOZ_ASSERT(id);
|
|
||||||
mPendingRequests.Remove(aRequest);
|
|
||||||
|
|
||||||
IPCInternalResponse ipcResp;
|
|
||||||
UniquePtr<mozilla::ipc::AutoIPCStream> autoStream;
|
|
||||||
nsIContentChild* cc = static_cast<ContentChild*>(Manager());
|
|
||||||
aResponse->ToIPC(&ipcResp, cc, autoStream);
|
|
||||||
Unused << SendFetchResponse(ipcResp, id);
|
|
||||||
if (autoStream) {
|
|
||||||
autoStream->TakeOptionalValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsITransportProvider>
|
|
||||||
FlyWebPublishedServerChild::OnWebSocketAcceptInternal(InternalRequest* aRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnWebSocketAcceptInternal(%p)", this);
|
|
||||||
|
|
||||||
if (!mActorExists) {
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnWebSocketAcceptInternal(%p) - No actor!", this);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t id = mPendingRequests.Get(aRequest);
|
|
||||||
MOZ_ASSERT(id);
|
|
||||||
mPendingRequests.Remove(aRequest);
|
|
||||||
|
|
||||||
RefPtr<TransportProviderChild> provider;
|
|
||||||
mPendingTransportProviders.Remove(id, getter_AddRefs(provider));
|
|
||||||
|
|
||||||
nsString protocol;
|
|
||||||
if (aProtocol.WasPassed()) {
|
|
||||||
protocol = aProtocol.Value();
|
|
||||||
|
|
||||||
nsAutoCString reqProtocols;
|
|
||||||
aRequest->Headers()->
|
|
||||||
GetFirst(NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"), reqProtocols, aRv);
|
|
||||||
if (!ContainsToken(reqProtocols, NS_ConvertUTF16toUTF8(protocol))) {
|
|
||||||
// Should throw a better error here
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
protocol.SetIsVoid(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Unused << SendWebSocketAccept(protocol, id);
|
|
||||||
|
|
||||||
return provider.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerChild::OnWebSocketResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnFetchResponse(%p)", this);
|
|
||||||
|
|
||||||
if (!mActorExists) {
|
|
||||||
LOG_I("FlyWebPublishedServerChild::OnFetchResponse(%p) - No actor!", this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t id = mPendingRequests.Get(aRequest);
|
|
||||||
MOZ_ASSERT(id);
|
|
||||||
mPendingRequests.Remove(aRequest);
|
|
||||||
|
|
||||||
mPendingTransportProviders.Remove(id);
|
|
||||||
|
|
||||||
IPCInternalResponse ipcResp;
|
|
||||||
UniquePtr<mozilla::ipc::AutoIPCStream> autoStream;
|
|
||||||
nsIContentChild* cc = static_cast<ContentChild*>(Manager());
|
|
||||||
aResponse->ToIPC(&ipcResp, cc, autoStream);
|
|
||||||
|
|
||||||
Unused << SendWebSocketResponse(ipcResp, id);
|
|
||||||
if (autoStream) {
|
|
||||||
autoStream->TakeOptionalValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerChild::Close()
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerChild::Close(%p)", this);
|
|
||||||
|
|
||||||
FlyWebPublishedServer::Close();
|
|
||||||
|
|
||||||
if (mActorExists) {
|
|
||||||
LOG_I("FlyWebPublishedServerChild::Close - sending __delete__ (%p)", this);
|
|
||||||
|
|
||||||
Send__delete__(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/******** FlyWebPublishedServerParent ********/
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(FlyWebPublishedServerParent, nsIDOMEventListener)
|
|
||||||
|
|
||||||
FlyWebPublishedServerParent::FlyWebPublishedServerParent(const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions)
|
|
||||||
: mActorDestroyed(false)
|
|
||||||
, mNextRequestId(1)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerParent::FlyWebPublishedServerParent(%p)", this);
|
|
||||||
|
|
||||||
RefPtr<FlyWebService> service = FlyWebService::GetOrCreate();
|
|
||||||
if (!service) {
|
|
||||||
Unused << SendServerReady(NS_ERROR_FAILURE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<FlyWebPublishPromise> mozPromise =
|
|
||||||
service->PublishServer(aName, aOptions, nullptr);
|
|
||||||
if (!mozPromise) {
|
|
||||||
Unused << SendServerReady(NS_ERROR_FAILURE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<FlyWebPublishedServerParent> self = this;
|
|
||||||
|
|
||||||
mozPromise->Then(
|
|
||||||
AbstractThread::MainThread(),
|
|
||||||
__func__,
|
|
||||||
[this, self] (FlyWebPublishedServer* aServer) {
|
|
||||||
mPublishedServer = static_cast<FlyWebPublishedServerImpl*>(aServer);
|
|
||||||
if (mActorDestroyed) {
|
|
||||||
mPublishedServer->Close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPublishedServer->AddEventListener(NS_LITERAL_STRING("fetch"),
|
|
||||||
this, false, false, 2);
|
|
||||||
mPublishedServer->AddEventListener(NS_LITERAL_STRING("websocket"),
|
|
||||||
this, false, false, 2);
|
|
||||||
mPublishedServer->AddEventListener(NS_LITERAL_STRING("close"),
|
|
||||||
this, false, false, 2);
|
|
||||||
Unused << SendServerReady(NS_OK);
|
|
||||||
},
|
|
||||||
[this, self] (nsresult aStatus) {
|
|
||||||
MOZ_ASSERT(NS_FAILED(aStatus));
|
|
||||||
if (!mActorDestroyed) {
|
|
||||||
Unused << SendServerReady(aStatus);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
FlyWebPublishedServerParent::HandleEvent(nsIDOMEvent* aEvent)
|
|
||||||
{
|
|
||||||
if (mActorDestroyed) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString type;
|
|
||||||
aEvent->GetType(type);
|
|
||||||
if (type.EqualsLiteral("close")) {
|
|
||||||
Unused << SendServerClose();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.EqualsLiteral("fetch")) {
|
|
||||||
RefPtr<InternalRequest> request =
|
|
||||||
static_cast<FlyWebFetchEvent*>(aEvent)->Request()->GetInternalRequest();
|
|
||||||
uint64_t id = mNextRequestId++;
|
|
||||||
mPendingRequests.Put(id, request);
|
|
||||||
|
|
||||||
IPCInternalRequest ipcReq;
|
|
||||||
request->ToIPC(&ipcReq);
|
|
||||||
Unused << SendFetchRequest(ipcReq, id);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.EqualsLiteral("websocket")) {
|
|
||||||
RefPtr<InternalRequest> request =
|
|
||||||
static_cast<FlyWebWebSocketEvent*>(aEvent)->Request()->GetInternalRequest();
|
|
||||||
uint64_t id = mNextRequestId++;
|
|
||||||
mPendingRequests.Put(id, request);
|
|
||||||
|
|
||||||
nsTArray<PNeckoParent*> neckoParents;
|
|
||||||
Manager()->ManagedPNeckoParent(neckoParents);
|
|
||||||
if (neckoParents.Length() != 1) {
|
|
||||||
MOZ_CRASH("Expected exactly 1 PNeckoParent instance per PNeckoChild");
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<TransportProviderParent> provider =
|
|
||||||
static_cast<TransportProviderParent*>(
|
|
||||||
neckoParents[0]->SendPTransportProviderConstructor());
|
|
||||||
|
|
||||||
IPCInternalRequest ipcReq;
|
|
||||||
request->ToIPC(&ipcReq);
|
|
||||||
Unused << SendWebSocketRequest(ipcReq, id, provider);
|
|
||||||
|
|
||||||
mPendingTransportProviders.Put(id, provider.forget());
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_CRASH("Unknown event type");
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerParent::RecvFetchResponse(const IPCInternalResponse& aResponse,
|
|
||||||
const uint64_t& aRequestId)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mActorDestroyed);
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> request;
|
|
||||||
mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
|
|
||||||
if (!request) {
|
|
||||||
static_cast<ContentParent*>(Manager())->KillHard("unknown request id");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<InternalResponse> response = InternalResponse::FromIPC(aResponse);
|
|
||||||
|
|
||||||
mPublishedServer->OnFetchResponse(request, response);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerParent::RecvWebSocketResponse(const IPCInternalResponse& aResponse,
|
|
||||||
const uint64_t& aRequestId)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mActorDestroyed);
|
|
||||||
|
|
||||||
mPendingTransportProviders.Remove(aRequestId);
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> request;
|
|
||||||
mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
|
|
||||||
if (!request) {
|
|
||||||
static_cast<ContentParent*>(Manager())->KillHard("unknown websocket request id");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<InternalResponse> response = InternalResponse::FromIPC(aResponse);
|
|
||||||
|
|
||||||
mPublishedServer->OnWebSocketResponse(request, response);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerParent::RecvWebSocketAccept(const nsString& aProtocol,
|
|
||||||
const uint64_t& aRequestId)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mActorDestroyed);
|
|
||||||
|
|
||||||
RefPtr<TransportProviderParent> providerIPC;
|
|
||||||
mPendingTransportProviders.Remove(aRequestId, getter_AddRefs(providerIPC));
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> request;
|
|
||||||
mPendingRequests.Remove(aRequestId, getter_AddRefs(request));
|
|
||||||
|
|
||||||
if (!request || !providerIPC) {
|
|
||||||
static_cast<ContentParent*>(Manager())->KillHard("unknown websocket request id");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<nsAString> protocol;
|
|
||||||
if (!aProtocol.IsVoid()) {
|
|
||||||
protocol = &aProtocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorResult result;
|
|
||||||
nsCOMPtr<nsITransportProvider> providerServer =
|
|
||||||
mPublishedServer->OnWebSocketAcceptInternal(request, protocol, result);
|
|
||||||
if (result.Failed()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
providerServer->SetListener(providerIPC);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebPublishedServerParent::ActorDestroy(ActorDestroyReason aWhy)
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerParent::ActorDestroy(%p)", this);
|
|
||||||
|
|
||||||
mActorDestroyed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FlyWebPublishedServerParent::Recv__delete__()
|
|
||||||
{
|
|
||||||
LOG_I("FlyWebPublishedServerParent::Recv__delete__(%p)", this);
|
|
||||||
MOZ_ASSERT(!mActorDestroyed);
|
|
||||||
|
|
||||||
if (mPublishedServer) {
|
|
||||||
mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("fetch"),
|
|
||||||
this, false);
|
|
||||||
mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("websocket"),
|
|
||||||
this, false);
|
|
||||||
mPublishedServer->RemoveEventListener(NS_LITERAL_STRING("close"),
|
|
||||||
this, false);
|
|
||||||
mPublishedServer->Close();
|
|
||||||
mPublishedServer = nullptr;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_FlyWebPublishedServer_h
|
|
||||||
#define mozilla_dom_FlyWebPublishedServer_h
|
|
||||||
|
|
||||||
#include "mozilla/DOMEventTargetHelper.h"
|
|
||||||
#include "mozilla/MozPromise.h"
|
|
||||||
|
|
||||||
class nsPIDOMWindowInner;
|
|
||||||
class nsITransportProvider;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
|
|
||||||
class ErrorResult;
|
|
||||||
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class InternalResponse;
|
|
||||||
class InternalRequest;
|
|
||||||
class WebSocket;
|
|
||||||
struct FlyWebPublishOptions;
|
|
||||||
class FlyWebPublishedServer;
|
|
||||||
|
|
||||||
typedef MozPromise<RefPtr<FlyWebPublishedServer>, nsresult, false>
|
|
||||||
FlyWebPublishPromise;
|
|
||||||
|
|
||||||
class FlyWebPublishedServer : public mozilla::DOMEventTargetHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FlyWebPublishedServer(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions);
|
|
||||||
|
|
||||||
virtual void LastRelease() override;
|
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
|
||||||
|
|
||||||
uint64_t OwnerWindowID() const {
|
|
||||||
return mOwnerWindowID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetName(nsAString& aName)
|
|
||||||
{
|
|
||||||
aName = mName;
|
|
||||||
}
|
|
||||||
nsAString& Name()
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetUiUrl(nsAString& aUiUrl)
|
|
||||||
{
|
|
||||||
aUiUrl = mUiUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void PermissionGranted(bool aGranted) = 0;
|
|
||||||
|
|
||||||
virtual void OnFetchResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse) = 0;
|
|
||||||
already_AddRefed<WebSocket>
|
|
||||||
OnWebSocketAccept(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
virtual void OnWebSocketResponse(InternalRequest* aConnectRequest,
|
|
||||||
InternalResponse* aResponse) = 0;
|
|
||||||
virtual already_AddRefed<nsITransportProvider>
|
|
||||||
OnWebSocketAcceptInternal(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv) = 0;
|
|
||||||
|
|
||||||
virtual void Close();
|
|
||||||
|
|
||||||
void FireFetchEvent(InternalRequest* aRequest);
|
|
||||||
void FireWebsocketEvent(InternalRequest* aConnectRequest);
|
|
||||||
void PublishedServerStarted(nsresult aStatus);
|
|
||||||
|
|
||||||
IMPL_EVENT_HANDLER(fetch)
|
|
||||||
IMPL_EVENT_HANDLER(websocket)
|
|
||||||
IMPL_EVENT_HANDLER(close)
|
|
||||||
|
|
||||||
already_AddRefed<FlyWebPublishPromise>
|
|
||||||
GetPublishPromise()
|
|
||||||
{
|
|
||||||
return mPublishPromise.Ensure(__func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~FlyWebPublishedServer()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!mIsRegistered, "Subclass dtor forgot to call Close()");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t mOwnerWindowID;
|
|
||||||
MozPromiseHolder<FlyWebPublishPromise> mPublishPromise;
|
|
||||||
|
|
||||||
nsString mName;
|
|
||||||
nsString mUiUrl;
|
|
||||||
|
|
||||||
bool mIsRegistered;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebPublishedServer_h
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_FlyWebPublishedServerIPC_h
|
|
||||||
#define mozilla_dom_FlyWebPublishedServerIPC_h
|
|
||||||
|
|
||||||
#include "HttpServer.h"
|
|
||||||
#include "mozilla/dom/FlyWebPublishedServer.h"
|
|
||||||
#include "mozilla/dom/PFlyWebPublishedServerParent.h"
|
|
||||||
#include "mozilla/dom/PFlyWebPublishedServerChild.h"
|
|
||||||
#include "mozilla/MozPromise.h"
|
|
||||||
#include "nsICancelable.h"
|
|
||||||
#include "nsIDOMEventListener.h"
|
|
||||||
#include "nsISupportsImpl.h"
|
|
||||||
|
|
||||||
class nsPIDOMWindowInner;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace net {
|
|
||||||
class TransportProviderParent;
|
|
||||||
class TransportProviderChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class FlyWebPublishedServerParent;
|
|
||||||
|
|
||||||
class FlyWebPublishedServerImpl final : public FlyWebPublishedServer
|
|
||||||
, public HttpServerListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FlyWebPublishedServerImpl(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
|
||||||
|
|
||||||
int32_t Port()
|
|
||||||
{
|
|
||||||
return mHttpServer ? mHttpServer->GetPort() : 0;
|
|
||||||
}
|
|
||||||
void GetCertKey(nsACString& aKey) {
|
|
||||||
if (mHttpServer) {
|
|
||||||
mHttpServer->GetCertKey(aKey);
|
|
||||||
} else {
|
|
||||||
aKey.Truncate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void PermissionGranted(bool aGranted) override;
|
|
||||||
virtual void OnFetchResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse) override;
|
|
||||||
virtual void OnWebSocketResponse(InternalRequest* aConnectRequest,
|
|
||||||
InternalResponse* aResponse) override;
|
|
||||||
virtual already_AddRefed<nsITransportProvider>
|
|
||||||
OnWebSocketAcceptInternal(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv) override;
|
|
||||||
|
|
||||||
void SetCancelRegister(nsICancelable* aCancelRegister)
|
|
||||||
{
|
|
||||||
mMDNSCancelRegister = aCancelRegister;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Close() override;
|
|
||||||
|
|
||||||
// HttpServerListener
|
|
||||||
virtual void OnServerStarted(nsresult aStatus) override;
|
|
||||||
virtual void OnRequest(InternalRequest* aRequest) override
|
|
||||||
{
|
|
||||||
FireFetchEvent(aRequest);
|
|
||||||
}
|
|
||||||
virtual void OnWebSocket(InternalRequest* aConnectRequest) override
|
|
||||||
{
|
|
||||||
FireWebsocketEvent(aConnectRequest);
|
|
||||||
}
|
|
||||||
virtual void OnServerClose() override
|
|
||||||
{
|
|
||||||
mHttpServer = nullptr;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
~FlyWebPublishedServerImpl() {}
|
|
||||||
|
|
||||||
RefPtr<HttpServer> mHttpServer;
|
|
||||||
nsCOMPtr<nsICancelable> mMDNSCancelRegister;
|
|
||||||
RefPtr<FlyWebPublishedServerParent> mServerParent;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FlyWebPublishedServerChild final : public FlyWebPublishedServer
|
|
||||||
, public PFlyWebPublishedServerChild
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FlyWebPublishedServerChild(nsPIDOMWindowInner* aOwner,
|
|
||||||
const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions);
|
|
||||||
|
|
||||||
virtual void PermissionGranted(bool aGranted) override;
|
|
||||||
virtual bool RecvServerReady(const nsresult& aStatus) override;
|
|
||||||
virtual bool RecvServerClose() override;
|
|
||||||
virtual bool RecvFetchRequest(const IPCInternalRequest& aRequest,
|
|
||||||
const uint64_t& aRequestId) override;
|
|
||||||
virtual bool RecvWebSocketRequest(const IPCInternalRequest& aRequest,
|
|
||||||
const uint64_t& aRequestId,
|
|
||||||
PTransportProviderChild* aProvider) override;
|
|
||||||
|
|
||||||
virtual void OnFetchResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse) override;
|
|
||||||
virtual void OnWebSocketResponse(InternalRequest* aConnectRequest,
|
|
||||||
InternalResponse* aResponse) override;
|
|
||||||
virtual already_AddRefed<nsITransportProvider>
|
|
||||||
OnWebSocketAcceptInternal(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv) override;
|
|
||||||
|
|
||||||
virtual void Close() override;
|
|
||||||
|
|
||||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
~FlyWebPublishedServerChild() {}
|
|
||||||
|
|
||||||
nsDataHashtable<nsRefPtrHashKey<InternalRequest>, uint64_t> mPendingRequests;
|
|
||||||
nsRefPtrHashtable<nsUint64HashKey, TransportProviderChild>
|
|
||||||
mPendingTransportProviders;
|
|
||||||
bool mActorExists;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FlyWebPublishedServerParent final : public PFlyWebPublishedServerParent
|
|
||||||
, public nsIDOMEventListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FlyWebPublishedServerParent(const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIDOMEVENTLISTENER
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual void
|
|
||||||
ActorDestroy(ActorDestroyReason aWhy) override;
|
|
||||||
|
|
||||||
virtual bool
|
|
||||||
Recv__delete__() override;
|
|
||||||
virtual bool
|
|
||||||
RecvFetchResponse(const IPCInternalResponse& aResponse,
|
|
||||||
const uint64_t& aRequestId) override;
|
|
||||||
virtual bool
|
|
||||||
RecvWebSocketResponse(const IPCInternalResponse& aResponse,
|
|
||||||
const uint64_t& aRequestId) override;
|
|
||||||
virtual bool
|
|
||||||
RecvWebSocketAccept(const nsString& aProtocol,
|
|
||||||
const uint64_t& aRequestId) override;
|
|
||||||
|
|
||||||
~FlyWebPublishedServerParent() {}
|
|
||||||
|
|
||||||
bool mActorDestroyed;
|
|
||||||
uint64_t mNextRequestId;
|
|
||||||
nsRefPtrHashtable<nsUint64HashKey, InternalRequest> mPendingRequests;
|
|
||||||
nsRefPtrHashtable<nsUint64HashKey, TransportProviderParent>
|
|
||||||
mPendingTransportProviders;
|
|
||||||
RefPtr<FlyWebPublishedServerImpl> mPublishedServer;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebPublishedServerIPC_h
|
|
||||||
|
|
@ -1,141 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "mozilla/dom/EventBinding.h"
|
|
||||||
#include "mozilla/dom/FlyWebFetchEventBinding.h"
|
|
||||||
#include "mozilla/dom/FlyWebPublishedServer.h"
|
|
||||||
#include "mozilla/dom/FlyWebServerEvents.h"
|
|
||||||
#include "mozilla/dom/FlyWebWebSocketEventBinding.h"
|
|
||||||
#include "mozilla/dom/Nullable.h"
|
|
||||||
#include "mozilla/dom/Promise.h"
|
|
||||||
#include "mozilla/dom/Response.h"
|
|
||||||
|
|
||||||
#include "js/GCAPI.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(FlyWebFetchEvent)
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
NS_IMPL_RELEASE_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRequest)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRequest)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FlyWebFetchEvent)
|
|
||||||
NS_INTERFACE_MAP_END_INHERITING(Event)
|
|
||||||
|
|
||||||
FlyWebFetchEvent::FlyWebFetchEvent(FlyWebPublishedServer* aServer,
|
|
||||||
class Request* aRequest,
|
|
||||||
InternalRequest* aInternalRequest)
|
|
||||||
: Event(aServer, nullptr, nullptr)
|
|
||||||
, mRequest(aRequest)
|
|
||||||
, mInternalRequest(aInternalRequest)
|
|
||||||
, mServer(aServer)
|
|
||||||
, mResponded(false)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aServer);
|
|
||||||
MOZ_ASSERT(aRequest);
|
|
||||||
MOZ_ASSERT(aInternalRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
FlyWebFetchEvent::~FlyWebFetchEvent()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject*
|
|
||||||
FlyWebFetchEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
||||||
{
|
|
||||||
return FlyWebFetchEventBinding::Wrap(aCx, this, aGivenProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebFetchEvent::RespondWith(Promise& aArg, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
if (mResponded) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mResponded = true;
|
|
||||||
|
|
||||||
aArg.AppendNativeHandler(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebFetchEvent::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
|
|
||||||
{
|
|
||||||
RefPtr<Response> response;
|
|
||||||
if (aValue.isObject()) {
|
|
||||||
UNWRAP_OBJECT(Response, &aValue.toObject(), response);
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<InternalResponse> intResponse;
|
|
||||||
if (response && response->Type() != ResponseType::Opaque) {
|
|
||||||
intResponse = response->GetInternalResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!intResponse) {
|
|
||||||
intResponse = InternalResponse::NetworkError();
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyServer(intResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebFetchEvent::NotifyServer(InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
mServer->OnFetchResponse(mInternalRequest, aResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebFetchEvent::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
|
|
||||||
{
|
|
||||||
RefPtr<InternalResponse> err = InternalResponse::NetworkError();
|
|
||||||
|
|
||||||
NotifyServer(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject*
|
|
||||||
FlyWebWebSocketEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
||||||
{
|
|
||||||
return FlyWebWebSocketEventBinding::Wrap(aCx, this, aGivenProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<WebSocket>
|
|
||||||
FlyWebWebSocketEvent::Accept(const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
if (mResponded) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
mResponded = true;
|
|
||||||
|
|
||||||
return mServer->OnWebSocketAccept(mInternalRequest, aProtocol, aRv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
FlyWebWebSocketEvent::NotifyServer(InternalResponse* aResponse)
|
|
||||||
{
|
|
||||||
mServer->OnWebSocketResponse(mInternalRequest, aResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
||||||
/* 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 mozilla_dom_FlyWebFetchEvent_h
|
|
||||||
#define mozilla_dom_FlyWebFetchEvent_h
|
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
|
||||||
#include "mozilla/ErrorResult.h"
|
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
|
||||||
#include "mozilla/dom/Event.h"
|
|
||||||
#include "mozilla/dom/FlyWebFetchEventBinding.h"
|
|
||||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
|
||||||
#include "mozilla/dom/WebSocket.h"
|
|
||||||
|
|
||||||
struct JSContext;
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class Request;
|
|
||||||
class Response;
|
|
||||||
class FlyWebPublishedServer;
|
|
||||||
class InternalRequest;
|
|
||||||
class InternalResponse;
|
|
||||||
|
|
||||||
class FlyWebFetchEvent : public Event
|
|
||||||
, public PromiseNativeHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(FlyWebFetchEvent, Event)
|
|
||||||
|
|
||||||
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
||||||
|
|
||||||
virtual void
|
|
||||||
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
|
|
||||||
virtual void
|
|
||||||
RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
|
|
||||||
|
|
||||||
class Request* Request() const
|
|
||||||
{
|
|
||||||
return mRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RespondWith(Promise& aArg, ErrorResult& aRv);
|
|
||||||
|
|
||||||
FlyWebFetchEvent(FlyWebPublishedServer* aServer,
|
|
||||||
class Request* aRequest,
|
|
||||||
InternalRequest* aInternalRequest);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~FlyWebFetchEvent();
|
|
||||||
|
|
||||||
virtual void NotifyServer(InternalResponse* aResponse);
|
|
||||||
|
|
||||||
RefPtr<class Request> mRequest;
|
|
||||||
RefPtr<InternalRequest> mInternalRequest;
|
|
||||||
RefPtr<FlyWebPublishedServer> mServer;
|
|
||||||
|
|
||||||
bool mResponded;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FlyWebWebSocketEvent final : public FlyWebFetchEvent
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FlyWebWebSocketEvent(FlyWebPublishedServer* aServer,
|
|
||||||
class Request* aRequest,
|
|
||||||
InternalRequest* aInternalRequest)
|
|
||||||
: FlyWebFetchEvent(aServer, aRequest, aInternalRequest)
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
||||||
|
|
||||||
already_AddRefed<WebSocket> Accept(const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
|
|
||||||
private:
|
|
||||||
~FlyWebWebSocketEvent() {};
|
|
||||||
|
|
||||||
virtual void NotifyServer(InternalResponse* aResponse) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebFetchEvent_h
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,113 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_FlyWebService_h
|
|
||||||
#define mozilla_dom_FlyWebService_h
|
|
||||||
|
|
||||||
#include "nsISupportsImpl.h"
|
|
||||||
#include "mozilla/ErrorResult.h"
|
|
||||||
#include "nsIProtocolHandler.h"
|
|
||||||
#include "nsDataHashtable.h"
|
|
||||||
#include "nsClassHashtable.h"
|
|
||||||
#include "nsIObserver.h"
|
|
||||||
#include "mozilla/MozPromise.h"
|
|
||||||
#include "mozilla/ReentrantMonitor.h"
|
|
||||||
#include "mozilla/dom/FlyWebDiscoveryManagerBinding.h"
|
|
||||||
#include "nsITimer.h"
|
|
||||||
#include "nsICancelable.h"
|
|
||||||
#include "nsIDNSServiceDiscovery.h"
|
|
||||||
|
|
||||||
class nsPIDOMWindowInner;
|
|
||||||
class nsIProxyInfo;
|
|
||||||
class nsISocketTransport;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
struct FlyWebPublishOptions;
|
|
||||||
struct FlyWebFilter;
|
|
||||||
class FlyWebPublishedServer;
|
|
||||||
class FlyWebPublishedServerImpl;
|
|
||||||
class FlyWebPairingCallback;
|
|
||||||
class FlyWebDiscoveryManager;
|
|
||||||
class FlyWebMDNSService;
|
|
||||||
|
|
||||||
typedef MozPromise<RefPtr<FlyWebPublishedServer>, nsresult, false>
|
|
||||||
FlyWebPublishPromise;
|
|
||||||
|
|
||||||
class FlyWebService final : public nsIObserver
|
|
||||||
{
|
|
||||||
friend class FlyWebMDNSService;
|
|
||||||
public:
|
|
||||||
NS_DECL_THREADSAFE_ISUPPORTS
|
|
||||||
NS_DECL_NSIOBSERVER
|
|
||||||
|
|
||||||
static FlyWebService* GetExisting();
|
|
||||||
static FlyWebService* GetOrCreate();
|
|
||||||
static already_AddRefed<FlyWebService> GetOrCreateAddRefed()
|
|
||||||
{
|
|
||||||
return do_AddRef(GetOrCreate());
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<FlyWebPublishPromise>
|
|
||||||
PublishServer(const nsAString& aName,
|
|
||||||
const FlyWebPublishOptions& aOptions,
|
|
||||||
nsPIDOMWindowInner* aWindow);
|
|
||||||
|
|
||||||
void UnregisterServer(FlyWebPublishedServer* aServer);
|
|
||||||
|
|
||||||
bool HasConnectionOrServer(uint64_t aWindowID);
|
|
||||||
|
|
||||||
void ListDiscoveredServices(nsTArray<FlyWebDiscoveredService>& aServices);
|
|
||||||
void PairWithService(const nsAString& aServiceId, FlyWebPairingCallback& aCallback);
|
|
||||||
nsresult CreateTransportForHost(const char **types,
|
|
||||||
uint32_t typeCount,
|
|
||||||
const nsACString &host,
|
|
||||||
int32_t port,
|
|
||||||
const nsACString &hostRoute,
|
|
||||||
int32_t portRoute,
|
|
||||||
nsIProxyInfo *proxyInfo,
|
|
||||||
nsISocketTransport **result);
|
|
||||||
|
|
||||||
already_AddRefed<FlyWebPublishedServer> FindPublishedServerByName(
|
|
||||||
const nsAString& aName);
|
|
||||||
|
|
||||||
void RegisterDiscoveryManager(FlyWebDiscoveryManager* aDiscoveryManager);
|
|
||||||
void UnregisterDiscoveryManager(FlyWebDiscoveryManager* aDiscoveryManager);
|
|
||||||
|
|
||||||
// Should only be called by FlyWebPublishedServerImpl
|
|
||||||
void StartDiscoveryOf(FlyWebPublishedServerImpl* aServer);
|
|
||||||
|
|
||||||
private:
|
|
||||||
FlyWebService();
|
|
||||||
~FlyWebService();
|
|
||||||
|
|
||||||
ErrorResult Init();
|
|
||||||
|
|
||||||
void NotifyDiscoveredServicesChanged();
|
|
||||||
|
|
||||||
// Might want to make these hashes for perf
|
|
||||||
nsTArray<FlyWebPublishedServer*> mServers;
|
|
||||||
|
|
||||||
RefPtr<FlyWebMDNSService> mMDNSHttpService;
|
|
||||||
RefPtr<FlyWebMDNSService> mMDNSFlywebService;
|
|
||||||
|
|
||||||
struct PairedInfo
|
|
||||||
{
|
|
||||||
FlyWebPairedService mService;
|
|
||||||
nsCOMPtr<nsIDNSServiceInfo> mDNSServiceInfo;
|
|
||||||
};
|
|
||||||
nsClassHashtable<nsCStringHashKey, PairedInfo>
|
|
||||||
mPairedServiceTable;
|
|
||||||
ReentrantMonitor mMonitor; // Protecting mPairedServiceTable
|
|
||||||
|
|
||||||
nsTHashtable<nsPtrHashKey<FlyWebDiscoveryManager>> mDiscoveryManagerTable;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_FlyWebService_h
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,193 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* 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 mozilla_dom_HttpServer_h
|
|
||||||
#define mozilla_dom_HttpServer_h
|
|
||||||
|
|
||||||
#include "nsISupportsImpl.h"
|
|
||||||
#include "mozilla/DOMEventTargetHelper.h"
|
|
||||||
#include "nsITLSServerSocket.h"
|
|
||||||
#include "nsIAsyncInputStream.h"
|
|
||||||
#include "nsIAsyncOutputStream.h"
|
|
||||||
#include "mozilla/Variant.h"
|
|
||||||
#include "nsIRequestObserver.h"
|
|
||||||
#include "mozilla/MozPromise.h"
|
|
||||||
#include "nsITransportProvider.h"
|
|
||||||
#include "nsILocalCertService.h"
|
|
||||||
|
|
||||||
class nsIX509Cert;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
extern bool
|
|
||||||
ContainsToken(const nsCString& aList, const nsCString& aToken);
|
|
||||||
|
|
||||||
class InternalRequest;
|
|
||||||
class InternalResponse;
|
|
||||||
|
|
||||||
class HttpServerListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// switch to NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING when that lands
|
|
||||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
|
||||||
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
|
||||||
|
|
||||||
virtual void OnServerStarted(nsresult aStatus) = 0;
|
|
||||||
virtual void OnRequest(InternalRequest* aRequest) = 0;
|
|
||||||
virtual void OnWebSocket(InternalRequest* aConnectRequest) = 0;
|
|
||||||
virtual void OnServerClose() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class HttpServer final : public nsIServerSocketListener,
|
|
||||||
public nsILocalCertGetCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
HttpServer();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSISERVERSOCKETLISTENER
|
|
||||||
NS_DECL_NSILOCALCERTGETCALLBACK
|
|
||||||
|
|
||||||
void Init(int32_t aPort, bool aHttps, HttpServerListener* aListener);
|
|
||||||
|
|
||||||
void SendResponse(InternalRequest* aRequest, InternalResponse* aResponse);
|
|
||||||
already_AddRefed<nsITransportProvider>
|
|
||||||
AcceptWebSocket(InternalRequest* aConnectRequest,
|
|
||||||
const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void SendWebSocketResponse(InternalRequest* aConnectRequest,
|
|
||||||
InternalResponse* aResponse);
|
|
||||||
|
|
||||||
void Close();
|
|
||||||
|
|
||||||
void GetCertKey(nsACString& aKey);
|
|
||||||
|
|
||||||
int32_t GetPort()
|
|
||||||
{
|
|
||||||
return mPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
~HttpServer();
|
|
||||||
|
|
||||||
nsresult StartServerSocket(nsIX509Cert* aCert);
|
|
||||||
void NotifyStarted(nsresult aStatus);
|
|
||||||
|
|
||||||
class TransportProvider final : public nsITransportProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSITRANSPORTPROVIDER
|
|
||||||
|
|
||||||
void SetTransport(nsISocketTransport* aTransport,
|
|
||||||
nsIAsyncInputStream* aInput,
|
|
||||||
nsIAsyncOutputStream* aOutput);
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~TransportProvider();
|
|
||||||
void MaybeNotify();
|
|
||||||
|
|
||||||
nsCOMPtr<nsIHttpUpgradeListener> mListener;
|
|
||||||
nsCOMPtr<nsISocketTransport> mTransport;
|
|
||||||
nsCOMPtr<nsIAsyncInputStream> mInput;
|
|
||||||
nsCOMPtr<nsIAsyncOutputStream> mOutput;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Connection final : public nsIInputStreamCallback
|
|
||||||
, public nsIOutputStreamCallback
|
|
||||||
, public nsITLSServerSecurityObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Connection(nsISocketTransport* aTransport,
|
|
||||||
HttpServer* aServer,
|
|
||||||
nsresult& rv);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIINPUTSTREAMCALLBACK
|
|
||||||
NS_DECL_NSIOUTPUTSTREAMCALLBACK
|
|
||||||
NS_DECL_NSITLSSERVERSECURITYOBSERVER
|
|
||||||
|
|
||||||
bool TryHandleResponse(InternalRequest* aRequest,
|
|
||||||
InternalResponse* aResponse);
|
|
||||||
already_AddRefed<nsITransportProvider>
|
|
||||||
HandleAcceptWebSocket(const Optional<nsAString>& aProtocol,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void HandleWebSocketResponse(InternalResponse* aResponse);
|
|
||||||
bool HasPendingWebSocketRequest(InternalRequest* aRequest)
|
|
||||||
{
|
|
||||||
return aRequest == mPendingWebSocketRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
~Connection();
|
|
||||||
|
|
||||||
void SetSecurityObserver(bool aListen);
|
|
||||||
|
|
||||||
static nsresult ReadSegmentsFunc(nsIInputStream* aIn,
|
|
||||||
void* aClosure,
|
|
||||||
const char* aBuffer,
|
|
||||||
uint32_t aToOffset,
|
|
||||||
uint32_t aCount,
|
|
||||||
uint32_t* aWriteCount);
|
|
||||||
nsresult ConsumeInput(const char*& aBuffer,
|
|
||||||
const char* aEnd);
|
|
||||||
nsresult ConsumeLine(const char* aBuffer,
|
|
||||||
size_t aLength);
|
|
||||||
void MaybeAddPendingHeader();
|
|
||||||
|
|
||||||
void QueueResponse(InternalResponse* aResponse);
|
|
||||||
|
|
||||||
RefPtr<HttpServer> mServer;
|
|
||||||
nsCOMPtr<nsISocketTransport> mTransport;
|
|
||||||
nsCOMPtr<nsIAsyncInputStream> mInput;
|
|
||||||
nsCOMPtr<nsIAsyncOutputStream> mOutput;
|
|
||||||
|
|
||||||
enum { eRequestLine, eHeaders, eBody, ePause } mState;
|
|
||||||
RefPtr<InternalRequest> mPendingReq;
|
|
||||||
uint32_t mPendingReqVersion;
|
|
||||||
nsCString mInputBuffer;
|
|
||||||
nsCString mPendingHeaderName;
|
|
||||||
nsCString mPendingHeaderValue;
|
|
||||||
uint32_t mRemainingBodySize;
|
|
||||||
nsCOMPtr<nsIAsyncOutputStream> mCurrentRequestBody;
|
|
||||||
bool mCloseAfterRequest;
|
|
||||||
|
|
||||||
typedef Pair<RefPtr<InternalRequest>,
|
|
||||||
RefPtr<InternalResponse>> PendingRequest;
|
|
||||||
nsTArray<PendingRequest> mPendingRequests;
|
|
||||||
RefPtr<MozPromise<nsresult, bool, false>> mOutputCopy;
|
|
||||||
|
|
||||||
RefPtr<InternalRequest> mPendingWebSocketRequest;
|
|
||||||
RefPtr<TransportProvider> mWebSocketTransportProvider;
|
|
||||||
|
|
||||||
struct OutputBuffer {
|
|
||||||
nsCString mString;
|
|
||||||
nsCOMPtr<nsIInputStream> mStream;
|
|
||||||
bool mChunked;
|
|
||||||
};
|
|
||||||
|
|
||||||
nsTArray<OutputBuffer> mOutputBuffers;
|
|
||||||
};
|
|
||||||
|
|
||||||
friend class Connection;
|
|
||||||
|
|
||||||
RefPtr<HttpServerListener> mListener;
|
|
||||||
nsCOMPtr<nsIServerSocket> mServerSocket;
|
|
||||||
nsCOMPtr<nsIX509Cert> mCert;
|
|
||||||
|
|
||||||
nsTArray<RefPtr<Connection>> mConnections;
|
|
||||||
|
|
||||||
int32_t mPort;
|
|
||||||
bool mHttps;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_HttpServer_h
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set sw=2 ts=8 et ft=cpp : */
|
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
include protocol PContent;
|
|
||||||
include protocol PSendStream;
|
|
||||||
include protocol PFileDescriptorSet;
|
|
||||||
include protocol PTransportProvider;
|
|
||||||
include FetchTypes;
|
|
||||||
include ChannelInfo;
|
|
||||||
include PBackgroundSharedTypes;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
async protocol PFlyWebPublishedServer
|
|
||||||
{
|
|
||||||
manager PContent;
|
|
||||||
|
|
||||||
child:
|
|
||||||
async ServerReady(nsresult aStatus);
|
|
||||||
async FetchRequest(IPCInternalRequest aRequest, uint64_t aRequestId);
|
|
||||||
async WebSocketRequest(IPCInternalRequest aRequest, uint64_t aRequestId,
|
|
||||||
PTransportProvider aProvider);
|
|
||||||
async ServerClose();
|
|
||||||
|
|
||||||
parent:
|
|
||||||
async __delete__();
|
|
||||||
|
|
||||||
async FetchResponse(IPCInternalResponse aResponse, uint64_t aRequestId);
|
|
||||||
async WebSocketResponse(IPCInternalResponse aResponse, uint64_t aRequestId);
|
|
||||||
async WebSocketAccept(nsString aProtocol, uint64_t aRequestId);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
|
||||||
# vim: set filetype=python:
|
|
||||||
# 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/.
|
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
|
||||||
'FlyWebDiscoveryManager.h',
|
|
||||||
'FlyWebPublishedServer.h',
|
|
||||||
'FlyWebPublishedServerIPC.h',
|
|
||||||
'FlyWebPublishOptionsIPCSerializer.h',
|
|
||||||
'FlyWebServerEvents.h',
|
|
||||||
'FlyWebService.h',
|
|
||||||
'HttpServer.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
|
||||||
'FlyWebDiscoveryManager.cpp',
|
|
||||||
'FlyWebPublishedServer.cpp',
|
|
||||||
'FlyWebServerEvents.cpp',
|
|
||||||
'FlyWebService.cpp',
|
|
||||||
'HttpServer.cpp'
|
|
||||||
]
|
|
||||||
|
|
||||||
IPDL_SOURCES += [
|
|
||||||
'PFlyWebPublishedServer.ipdl',
|
|
||||||
]
|
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
|
||||||
'/dom/base',
|
|
||||||
'/netwerk/base',
|
|
||||||
'/netwerk/dns',
|
|
||||||
'/netwerk/protocol/websocket',
|
|
||||||
'/xpcom/io'
|
|
||||||
]
|
|
||||||
|
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
|
||||||
|
|
||||||
if CONFIG['GNU_CXX']:
|
|
||||||
CXXFLAGS += ['-Wshadow']
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
#include "mozilla/dom/DataTransfer.h"
|
#include "mozilla/dom/DataTransfer.h"
|
||||||
#include "mozilla/dom/DOMStorageIPC.h"
|
#include "mozilla/dom/DOMStorageIPC.h"
|
||||||
#include "mozilla/dom/ExternalHelperAppChild.h"
|
#include "mozilla/dom/ExternalHelperAppChild.h"
|
||||||
#include "mozilla/dom/FlyWebPublishedServerIPC.h"
|
|
||||||
#include "mozilla/dom/GetFilesHelper.h"
|
#include "mozilla/dom/GetFilesHelper.h"
|
||||||
#include "mozilla/dom/ProcessGlobal.h"
|
#include "mozilla/dom/ProcessGlobal.h"
|
||||||
#include "mozilla/dom/PushNotifier.h"
|
#include "mozilla/dom/PushNotifier.h"
|
||||||
|
|
@ -1415,22 +1414,6 @@ ContentChild::SendPBlobConstructor(PBlobChild* aActor,
|
||||||
return PContentChild::SendPBlobConstructor(aActor, aParams);
|
return PContentChild::SendPBlobConstructor(aActor, aParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
PFlyWebPublishedServerChild*
|
|
||||||
ContentChild::AllocPFlyWebPublishedServerChild(const nsString& name,
|
|
||||||
const FlyWebPublishOptions& params)
|
|
||||||
{
|
|
||||||
MOZ_CRASH("We should never be manually allocating PFlyWebPublishedServerChild actors");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ContentChild::DeallocPFlyWebPublishedServerChild(PFlyWebPublishedServerChild* aActor)
|
|
||||||
{
|
|
||||||
RefPtr<FlyWebPublishedServerChild> actor =
|
|
||||||
dont_AddRef(static_cast<FlyWebPublishedServerChild*>(aActor));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContentChild::RecvNotifyEmptyHTTPCache()
|
ContentChild::RecvNotifyEmptyHTTPCache()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -297,12 +297,6 @@ public:
|
||||||
|
|
||||||
virtual bool DeallocPStorageChild(PStorageChild* aActor) override;
|
virtual bool DeallocPStorageChild(PStorageChild* aActor) override;
|
||||||
|
|
||||||
virtual PFlyWebPublishedServerChild*
|
|
||||||
AllocPFlyWebPublishedServerChild(const nsString& name,
|
|
||||||
const FlyWebPublishOptions& params) override;
|
|
||||||
|
|
||||||
virtual bool DeallocPFlyWebPublishedServerChild(PFlyWebPublishedServerChild* aActor) override;
|
|
||||||
|
|
||||||
virtual bool RecvNotifyEmptyHTTPCache() override;
|
virtual bool RecvNotifyEmptyHTTPCache() override;
|
||||||
|
|
||||||
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
|
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@
|
||||||
#include "mozilla/dom/power/PowerManagerService.h"
|
#include "mozilla/dom/power/PowerManagerService.h"
|
||||||
#include "mozilla/dom/Permissions.h"
|
#include "mozilla/dom/Permissions.h"
|
||||||
#include "mozilla/dom/PushNotifier.h"
|
#include "mozilla/dom/PushNotifier.h"
|
||||||
#include "mozilla/dom/FlyWebPublishedServerIPC.h"
|
|
||||||
#include "mozilla/dom/quota/QuotaManagerService.h"
|
#include "mozilla/dom/quota/QuotaManagerService.h"
|
||||||
#include "mozilla/dom/time/DateCacheCleaner.h"
|
#include "mozilla/dom/time/DateCacheCleaner.h"
|
||||||
#include "mozilla/embedding/printingui/PrintingParent.h"
|
#include "mozilla/embedding/printingui/PrintingParent.h"
|
||||||
|
|
@ -3121,23 +3120,6 @@ ContentParent::DeallocPStorageParent(PStorageParent* aActor)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PFlyWebPublishedServerParent*
|
|
||||||
ContentParent::AllocPFlyWebPublishedServerParent(const nsString& name,
|
|
||||||
const FlyWebPublishOptions& params)
|
|
||||||
{
|
|
||||||
RefPtr<FlyWebPublishedServerParent> actor =
|
|
||||||
new FlyWebPublishedServerParent(name, params);
|
|
||||||
return actor.forget().take();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ContentParent::DeallocPFlyWebPublishedServerParent(PFlyWebPublishedServerParent* aActor)
|
|
||||||
{
|
|
||||||
RefPtr<FlyWebPublishedServerParent> actor =
|
|
||||||
dont_AddRef(static_cast<FlyWebPublishedServerParent*>(aActor));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PSpeechSynthesisParent*
|
PSpeechSynthesisParent*
|
||||||
ContentParent::AllocPSpeechSynthesisParent()
|
ContentParent::AllocPSpeechSynthesisParent()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -800,12 +800,6 @@ private:
|
||||||
|
|
||||||
virtual bool DeallocPStorageParent(PStorageParent* aActor) override;
|
virtual bool DeallocPStorageParent(PStorageParent* aActor) override;
|
||||||
|
|
||||||
virtual PFlyWebPublishedServerParent*
|
|
||||||
AllocPFlyWebPublishedServerParent(const nsString& name,
|
|
||||||
const FlyWebPublishOptions& params) override;
|
|
||||||
|
|
||||||
virtual bool DeallocPFlyWebPublishedServerParent(PFlyWebPublishedServerParent* aActor) override;
|
|
||||||
|
|
||||||
virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() override;
|
virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() override;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ include protocol PRemoteSpellcheckEngine;
|
||||||
include protocol PWebBrowserPersistDocument;
|
include protocol PWebBrowserPersistDocument;
|
||||||
include protocol PWebrtcGlobal;
|
include protocol PWebrtcGlobal;
|
||||||
include protocol PVideoDecoderManager;
|
include protocol PVideoDecoderManager;
|
||||||
include protocol PFlyWebPublishedServer;
|
|
||||||
include DOMTypes;
|
include DOMTypes;
|
||||||
include JavaScriptTypes;
|
include JavaScriptTypes;
|
||||||
include InputStreamParams;
|
include InputStreamParams;
|
||||||
|
|
@ -87,7 +86,6 @@ using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/Structu
|
||||||
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
|
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
|
||||||
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||||
using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h";
|
|
||||||
|
|
||||||
union ChromeRegistryItem
|
union ChromeRegistryItem
|
||||||
{
|
{
|
||||||
|
|
@ -259,7 +257,6 @@ nested(upto inside_cpow) sync protocol PContent
|
||||||
manages PRemoteSpellcheckEngine;
|
manages PRemoteSpellcheckEngine;
|
||||||
manages PWebBrowserPersistDocument;
|
manages PWebBrowserPersistDocument;
|
||||||
manages PWebrtcGlobal;
|
manages PWebrtcGlobal;
|
||||||
manages PFlyWebPublishedServer;
|
|
||||||
|
|
||||||
both:
|
both:
|
||||||
// Depending on exactly how the new browser is being created, it might be
|
// Depending on exactly how the new browser is being created, it might be
|
||||||
|
|
@ -668,8 +665,6 @@ parent:
|
||||||
|
|
||||||
async PWebrtcGlobal();
|
async PWebrtcGlobal();
|
||||||
|
|
||||||
async PFlyWebPublishedServer(nsString name, FlyWebPublishOptions params);
|
|
||||||
|
|
||||||
// Services remoting
|
// Services remoting
|
||||||
|
|
||||||
async StartVisitedQuery(URIParams uri);
|
async StartVisitedQuery(URIParams uri);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
|
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsLayoutStylesheetCache.h"
|
#include "nsLayoutStylesheetCache.h"
|
||||||
#include "nsRuleData.h"
|
#include "nsRuleData.h"
|
||||||
|
|
@ -150,8 +151,9 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
const nsAString& aValue,
|
const nsAString& aValue,
|
||||||
nsAttrValue& aResult)
|
nsAttrValue& aResult)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(IsMathMLElement());
|
||||||
if (aNamespaceID == kNameSpaceID_None) {
|
if (aNamespaceID == kNameSpaceID_None) {
|
||||||
if (IsMathMLElement(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
|
if (mNodeInfo->Equals(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
|
||||||
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
|
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
|
||||||
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
|
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
|
||||||
}
|
}
|
||||||
|
|
@ -165,6 +167,16 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
aAttribute == nsGkAtoms::mathbackground_) {
|
aAttribute == nsGkAtoms::mathbackground_) {
|
||||||
return aResult.ParseColor(aValue);
|
return aResult.ParseColor(aValue);
|
||||||
}
|
}
|
||||||
|
if (mNodeInfo->Equals(nsGkAtoms::mtd_)) {
|
||||||
|
if (aAttribute == nsGkAtoms::columnspan_) {
|
||||||
|
aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (aAttribute == nsGkAtoms::rowspan) {
|
||||||
|
aResult.ParseClampedNonNegativeInt(aValue, 1, 0, MAX_ROWSPAN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
|
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
|
||||||
|
|
@ -209,6 +221,8 @@ static Element::MappedAttributeEntry sDirStyles[] = {
|
||||||
bool
|
bool
|
||||||
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(IsMathMLElement());
|
||||||
|
|
||||||
static const MappedAttributeEntry* const mtableMap[] = {
|
static const MappedAttributeEntry* const mtableMap[] = {
|
||||||
sMtableStyles,
|
sMtableStyles,
|
||||||
sCommonPresStyles
|
sCommonPresStyles
|
||||||
|
|
@ -240,10 +254,10 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
if (IsAnyOfMathMLElements(nsGkAtoms::mstyle_, nsGkAtoms::math))
|
if (IsAnyOfMathMLElements(nsGkAtoms::mstyle_, nsGkAtoms::math))
|
||||||
return FindAttributeDependence(aAttribute, mstyleMap);
|
return FindAttributeDependence(aAttribute, mstyleMap);
|
||||||
|
|
||||||
if (IsMathMLElement(nsGkAtoms::mtable_))
|
if (mNodeInfo->Equals(nsGkAtoms::mtable_))
|
||||||
return FindAttributeDependence(aAttribute, mtableMap);
|
return FindAttributeDependence(aAttribute, mtableMap);
|
||||||
|
|
||||||
if (IsMathMLElement(nsGkAtoms::mrow_))
|
if (mNodeInfo->Equals(nsGkAtoms::mrow_))
|
||||||
return FindAttributeDependence(aAttribute, mrowMap);
|
return FindAttributeDependence(aAttribute, mrowMap);
|
||||||
|
|
||||||
if (IsAnyOfMathMLElements(nsGkAtoms::maction_,
|
if (IsAnyOfMathMLElements(nsGkAtoms::maction_,
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ DIRS += [
|
||||||
'fetch',
|
'fetch',
|
||||||
'filehandle',
|
'filehandle',
|
||||||
'filesystem',
|
'filesystem',
|
||||||
'flyweb',
|
|
||||||
'gamepad',
|
'gamepad',
|
||||||
'geolocation',
|
'geolocation',
|
||||||
'grid',
|
'grid',
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
/* -*- Mode: IDL; 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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
dictionary FlyWebDiscoveredService {
|
|
||||||
DOMString serviceId = "";
|
|
||||||
DOMString displayName = "";
|
|
||||||
DOMString transport = "";
|
|
||||||
DOMString serviceType = "";
|
|
||||||
DOMString cert = "";
|
|
||||||
DOMString path = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary FlyWebPairedService {
|
|
||||||
FlyWebDiscoveredService discoveredService;
|
|
||||||
DOMString hostname = "";
|
|
||||||
DOMString uiUrl = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
callback interface FlyWebPairingCallback {
|
|
||||||
void pairingSucceeded(optional FlyWebPairedService service);
|
|
||||||
void pairingFailed(DOMString error);
|
|
||||||
};
|
|
||||||
|
|
||||||
callback interface FlyWebDiscoveryCallback {
|
|
||||||
void onDiscoveredServicesChanged(sequence<FlyWebDiscoveredService> serviceList);
|
|
||||||
};
|
|
||||||
|
|
||||||
[ChromeOnly, ChromeConstructor, Exposed=(Window,System)]
|
|
||||||
interface FlyWebDiscoveryManager {
|
|
||||||
sequence<FlyWebDiscoveredService> listServices();
|
|
||||||
|
|
||||||
unsigned long startDiscovery(FlyWebDiscoveryCallback aCallback);
|
|
||||||
void stopDiscovery(unsigned long aId);
|
|
||||||
|
|
||||||
void pairWithService(DOMString serviceId, FlyWebPairingCallback callback);
|
|
||||||
};
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
/* -*- Mode: IDL; 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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Pref="dom.flyweb.enabled"]
|
|
||||||
interface FlyWebFetchEvent : Event {
|
|
||||||
[SameObject] readonly attribute Request request;
|
|
||||||
|
|
||||||
[Throws]
|
|
||||||
void respondWith(Promise<Response> r);
|
|
||||||
};
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
/* -*- Mode: IDL; 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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Pref="dom.flyweb.enabled"]
|
|
||||||
interface FlyWebPublishedServer : EventTarget {
|
|
||||||
readonly attribute DOMString name;
|
|
||||||
readonly attribute DOMString? uiUrl;
|
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
attribute EventHandler onclose;
|
|
||||||
attribute EventHandler onfetch;
|
|
||||||
attribute EventHandler onwebsocket;
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary FlyWebPublishOptions {
|
|
||||||
DOMString? uiUrl = null; // URL to user interface. Can be different server. Makes
|
|
||||||
// endpoint show up in browser's "local services" UI.
|
|
||||||
// If relative, resolves against the root of the server.
|
|
||||||
};
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
/* -*- Mode: IDL; 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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Pref="dom.flyweb.enabled"]
|
|
||||||
interface FlyWebWebSocketEvent : Event {
|
|
||||||
[SameObject] readonly attribute Request request;
|
|
||||||
|
|
||||||
[Throws]
|
|
||||||
WebSocket accept(optional DOMString protocol);
|
|
||||||
|
|
||||||
[Throws]
|
|
||||||
void respondWith(Promise<Response> r);
|
|
||||||
};
|
|
||||||
|
|
@ -132,12 +132,6 @@ partial interface Navigator {
|
||||||
Promise<BatteryManager> getBattery();
|
Promise<BatteryManager> getBattery();
|
||||||
};
|
};
|
||||||
|
|
||||||
partial interface Navigator {
|
|
||||||
[NewObject, Pref="dom.flyweb.enabled"]
|
|
||||||
Promise<FlyWebPublishedServer> publishServer(DOMString name,
|
|
||||||
optional FlyWebPublishOptions options);
|
|
||||||
};
|
|
||||||
|
|
||||||
// http://www.w3.org/TR/vibration/#vibration-interface
|
// http://www.w3.org/TR/vibration/#vibration-interface
|
||||||
partial interface Navigator {
|
partial interface Navigator {
|
||||||
// We don't support sequences in unions yet
|
// We don't support sequences in unions yet
|
||||||
|
|
|
||||||
|
|
@ -151,10 +151,6 @@ WEBIDL_FILES = [
|
||||||
'FileSystemDirectoryReader.webidl',
|
'FileSystemDirectoryReader.webidl',
|
||||||
'FileSystemEntry.webidl',
|
'FileSystemEntry.webidl',
|
||||||
'FileSystemFileEntry.webidl',
|
'FileSystemFileEntry.webidl',
|
||||||
'FlyWebDiscoveryManager.webidl',
|
|
||||||
'FlyWebFetchEvent.webidl',
|
|
||||||
'FlyWebPublish.webidl',
|
|
||||||
'FlyWebWebSocketEvent.webidl',
|
|
||||||
'FocusEvent.webidl',
|
'FocusEvent.webidl',
|
||||||
'FontFace.webidl',
|
'FontFace.webidl',
|
||||||
'FontFaceSet.webidl',
|
'FontFaceSet.webidl',
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,6 @@ static void Shutdown();
|
||||||
#include "AudioChannelService.h"
|
#include "AudioChannelService.h"
|
||||||
#include "mozilla/net/WebSocketEventService.h"
|
#include "mozilla/net/WebSocketEventService.h"
|
||||||
|
|
||||||
#include "mozilla/dom/FlyWebService.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/power/PowerManagerService.h"
|
#include "mozilla/dom/power/PowerManagerService.h"
|
||||||
#include "mozilla/dom/time/TimeService.h"
|
#include "mozilla/dom/time/TimeService.h"
|
||||||
#include "StreamingProtocolService.h"
|
#include "StreamingProtocolService.h"
|
||||||
|
|
@ -510,17 +508,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(Geolocation, Init)
|
||||||
#define NS_WEBSOCKETEVENT_SERVICE_CID \
|
#define NS_WEBSOCKETEVENT_SERVICE_CID \
|
||||||
{ 0x31689828, 0xda66, 0x49a6, { 0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 }}
|
{ 0x31689828, 0xda66, 0x49a6, { 0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 }}
|
||||||
|
|
||||||
#define NS_FLYWEB_SERVICE_CID \
|
|
||||||
{ 0x5de19ef0, 0x895e, 0x4c0c, { 0xa6, 0xe0, 0xea, 0xe0, 0x23, 0x2b, 0x84, 0x5a } }
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService)
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService)
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AudioChannelService, AudioChannelService::GetOrCreate)
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AudioChannelService, AudioChannelService::GetOrCreate)
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService, WebSocketEventService::GetOrCreate)
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService, WebSocketEventService::GetOrCreate)
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(FlyWebService, FlyWebService::GetOrCreateAddRefed)
|
|
||||||
|
|
||||||
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(FakeSpeechRecognitionService)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(FakeSpeechRecognitionService)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -657,7 +650,6 @@ NS_DEFINE_NAMED_CID(NS_GEOLOCATION_SERVICE_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
|
NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_AUDIOCHANNEL_SERVICE_CID);
|
NS_DEFINE_NAMED_CID(NS_AUDIOCHANNEL_SERVICE_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID);
|
NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_FLYWEB_SERVICE_CID);
|
|
||||||
NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
|
NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
|
||||||
NS_DEFINE_NAMED_CID(NS_CONTENTSECURITYMANAGER_CID);
|
NS_DEFINE_NAMED_CID(NS_CONTENTSECURITYMANAGER_CID);
|
||||||
NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
|
NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
|
||||||
|
|
@ -919,7 +911,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
||||||
{ &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor },
|
{ &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor },
|
||||||
{ &kNS_AUDIOCHANNEL_SERVICE_CID, false, nullptr, AudioChannelServiceConstructor },
|
{ &kNS_AUDIOCHANNEL_SERVICE_CID, false, nullptr, AudioChannelServiceConstructor },
|
||||||
{ &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor },
|
{ &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor },
|
||||||
{ &kNS_FLYWEB_SERVICE_CID, false, nullptr, FlyWebServiceConstructor },
|
|
||||||
{ &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager },
|
{ &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager },
|
||||||
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
||||||
{ &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID, false, nullptr, FakeSpeechRecognitionServiceConstructor },
|
{ &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID, false, nullptr, FakeSpeechRecognitionServiceConstructor },
|
||||||
|
|
@ -1046,8 +1037,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
||||||
{ "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
|
{ "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
|
||||||
{ "@mozilla.org/audiochannel/service;1", &kNS_AUDIOCHANNEL_SERVICE_CID },
|
{ "@mozilla.org/audiochannel/service;1", &kNS_AUDIOCHANNEL_SERVICE_CID },
|
||||||
{ "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID },
|
{ "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID },
|
||||||
{ "@mozilla.org/flyweb-service;1", &kNS_FLYWEB_SERVICE_CID },
|
|
||||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "flyweb", &kNS_FLYWEB_SERVICE_CID },
|
|
||||||
{ "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
|
{ "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
|
||||||
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
|
||||||
{ NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake", &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID },
|
{ NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake", &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID },
|
||||||
|
|
|
||||||
|
|
@ -1160,47 +1160,6 @@ nsMathMLmtdFrame::Init(nsIContent* aContent,
|
||||||
RemoveStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
|
RemoveStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
|
||||||
nsMathMLmtdFrame::GetRowSpan()
|
|
||||||
{
|
|
||||||
int32_t rowspan = 1;
|
|
||||||
|
|
||||||
// Don't look at the content's rowspan if we're not an mtd or a pseudo cell.
|
|
||||||
if (mContent->IsMathMLElement(nsGkAtoms::mtd_) &&
|
|
||||||
!StyleContext()->GetPseudo()) {
|
|
||||||
nsAutoString value;
|
|
||||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rowspan, value);
|
|
||||||
if (!value.IsEmpty()) {
|
|
||||||
nsresult error;
|
|
||||||
rowspan = value.ToInteger(&error);
|
|
||||||
if (NS_FAILED(error) || rowspan < 0)
|
|
||||||
rowspan = 1;
|
|
||||||
rowspan = std::min(rowspan, MAX_ROWSPAN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rowspan;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t
|
|
||||||
nsMathMLmtdFrame::GetColSpan()
|
|
||||||
{
|
|
||||||
int32_t colspan = 1;
|
|
||||||
|
|
||||||
// Don't look at the content's colspan if we're not an mtd or a pseudo cell.
|
|
||||||
if (mContent->IsMathMLElement(nsGkAtoms::mtd_) &&
|
|
||||||
!StyleContext()->GetPseudo()) {
|
|
||||||
nsAutoString value;
|
|
||||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::columnspan_, value);
|
|
||||||
if (!value.IsEmpty()) {
|
|
||||||
nsresult error;
|
|
||||||
colspan = value.ToInteger(&error);
|
|
||||||
if (NS_FAILED(error) || colspan <= 0 || colspan > MAX_COLSPAN)
|
|
||||||
colspan = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return colspan;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsMathMLmtdFrame::AttributeChanged(int32_t aNameSpaceID,
|
nsMathMLmtdFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
|
|
|
||||||
|
|
@ -257,8 +257,6 @@ public:
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
virtual int32_t GetRowSpan() override;
|
|
||||||
virtual int32_t GetColSpan() override;
|
|
||||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||||
{
|
{
|
||||||
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#define CellData_h__
|
#define CellData_h__
|
||||||
|
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
|
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
#include "mozilla/gfx/Types.h"
|
#include "mozilla/gfx/Types.h"
|
||||||
#include "mozilla/WritingModes.h"
|
#include "mozilla/WritingModes.h"
|
||||||
|
|
@ -15,11 +16,6 @@ class nsTableCellFrame;
|
||||||
class nsCellMap;
|
class nsCellMap;
|
||||||
class BCCellData;
|
class BCCellData;
|
||||||
|
|
||||||
|
|
||||||
#define MAX_ROWSPAN 65534 // the cellmap can not handle more.
|
|
||||||
#define MAX_COLSPAN 1000 // limit as IE and opera do. If this ever changes,
|
|
||||||
// change COL_SPAN_OFFSET/COL_SPAN_SHIFT accordingly.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data stored by nsCellMap to rationalize rowspan and colspan cells.
|
* Data stored by nsCellMap to rationalize rowspan and colspan cells.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
#include "nsQueryFrame.h"
|
#include "nsQueryFrame.h"
|
||||||
|
|
||||||
|
#define MAX_ROWSPAN 65534 // the cellmap can not handle more.
|
||||||
|
#define MAX_COLSPAN 1000 // limit as IE and opera do. If this ever changes,
|
||||||
|
// change COL_SPAN_OFFSET/COL_SPAN_SHIFT accordingly.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsITableCellLayout
|
* nsITableCellLayout
|
||||||
* interface for layout objects that act like table cells.
|
* interface for layout objects that act like table cells.
|
||||||
|
|
|
||||||
|
|
@ -711,16 +711,18 @@ nsTableCellFrame::GetCellBaseline() const
|
||||||
borderPadding;
|
borderPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nsTableCellFrame::GetRowSpan()
|
int32_t
|
||||||
|
nsTableCellFrame::GetRowSpan()
|
||||||
{
|
{
|
||||||
int32_t rowSpan=1;
|
int32_t rowSpan=1;
|
||||||
nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent);
|
|
||||||
|
|
||||||
// Don't look at the content's rowspan if we're a pseudo cell
|
// Don't look at the content's rowspan if we're a pseudo cell
|
||||||
if (hc && !StyleContext()->GetPseudo()) {
|
if (!StyleContext()->GetPseudo()) {
|
||||||
const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::rowspan);
|
dom::Element* elem = mContent->AsElement();
|
||||||
|
const nsAttrValue* attr = elem->GetParsedAttr(nsGkAtoms::rowspan);
|
||||||
// Note that we don't need to check the tag name, because only table cells
|
// Note that we don't need to check the tag name, because only table cells
|
||||||
// and table headers parse the "rowspan" attribute into an integer.
|
// (including MathML <mtd>) and table headers parse the "rowspan" attribute
|
||||||
|
// into an integer.
|
||||||
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
||||||
rowSpan = attr->GetIntegerValue();
|
rowSpan = attr->GetIntegerValue();
|
||||||
}
|
}
|
||||||
|
|
@ -728,16 +730,20 @@ int32_t nsTableCellFrame::GetRowSpan()
|
||||||
return rowSpan;
|
return rowSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nsTableCellFrame::GetColSpan()
|
int32_t
|
||||||
|
nsTableCellFrame::GetColSpan()
|
||||||
{
|
{
|
||||||
int32_t colSpan=1;
|
int32_t colSpan=1;
|
||||||
nsGenericHTMLElement *hc = nsGenericHTMLElement::FromContent(mContent);
|
|
||||||
|
|
||||||
// Don't look at the content's colspan if we're a pseudo cell
|
// Don't look at the content's colspan if we're a pseudo cell
|
||||||
if (hc && !StyleContext()->GetPseudo()) {
|
if (!StyleContext()->GetPseudo()) {
|
||||||
const nsAttrValue* attr = hc->GetParsedAttr(nsGkAtoms::colspan);
|
dom::Element* elem = mContent->AsElement();
|
||||||
|
const nsAttrValue* attr = elem->GetParsedAttr(
|
||||||
|
MOZ_UNLIKELY(elem->IsMathMLElement()) ? nsGkAtoms::columnspan_
|
||||||
|
: nsGkAtoms::colspan);
|
||||||
// Note that we don't need to check the tag name, because only table cells
|
// Note that we don't need to check the tag name, because only table cells
|
||||||
// and table headers parse the "colspan" attribute into an integer.
|
// (including MathML <mtd>) and table headers parse the "colspan" attribute
|
||||||
|
// into an integer.
|
||||||
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
if (attr && attr->Type() == nsAttrValue::eInteger) {
|
||||||
colSpan = attr->GetIntegerValue();
|
colSpan = attr->GetIntegerValue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,11 +165,11 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the cell's specified row span. this is what was specified in the
|
* return the cell's specified row span. this is what was specified in the
|
||||||
* content model or in the style info, and is always >= 1.
|
* content model or in the style info, and is always >= 0.
|
||||||
* to get the effective row span (the actual value that applies), use GetEffectiveRowSpan()
|
* to get the effective row span (the actual value that applies), use GetEffectiveRowSpan()
|
||||||
* @see nsTableFrame::GetEffectiveRowSpan()
|
* @see nsTableFrame::GetEffectiveRowSpan()
|
||||||
*/
|
*/
|
||||||
virtual int32_t GetRowSpan();
|
int32_t GetRowSpan();
|
||||||
|
|
||||||
// there is no set row index because row index depends on the cell's parent row only
|
// there is no set row index because row index depends on the cell's parent row only
|
||||||
|
|
||||||
|
|
@ -191,7 +191,7 @@ public:
|
||||||
* to get the effective col span (the actual value that applies), use GetEffectiveColSpan()
|
* to get the effective col span (the actual value that applies), use GetEffectiveColSpan()
|
||||||
* @see nsTableFrame::GetEffectiveColSpan()
|
* @see nsTableFrame::GetEffectiveColSpan()
|
||||||
*/
|
*/
|
||||||
virtual int32_t GetColSpan();
|
int32_t GetColSpan();
|
||||||
|
|
||||||
/** return the cell's column index (starting at 0 for the first column) */
|
/** return the cell's column index (starting at 0 for the first column) */
|
||||||
virtual nsresult GetColIndex(int32_t &aColIndex) const override;
|
virtual nsresult GetColIndex(int32_t &aColIndex) const override;
|
||||||
|
|
|
||||||
|
|
@ -4972,8 +4972,6 @@ pref("dom.forms.inputmode", true);
|
||||||
// InputMethods for soft keyboards in B2G
|
// InputMethods for soft keyboards in B2G
|
||||||
pref("dom.mozInputMethod.enabled", false);
|
pref("dom.mozInputMethod.enabled", false);
|
||||||
|
|
||||||
pref("dom.flyweb.enabled", false);
|
|
||||||
|
|
||||||
// Enable mapped array buffer by default.
|
// Enable mapped array buffer by default.
|
||||||
pref("dom.mapped_arraybuffer.enabled", true);
|
pref("dom.mapped_arraybuffer.enabled", true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsIFile.h"
|
#include "nsIFile.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "mozilla/dom/FlyWebService.h"
|
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
#include "mozilla/WindowsVersion.h"
|
#include "mozilla/WindowsVersion.h"
|
||||||
|
|
@ -685,20 +684,6 @@ nsSocketTransportService::CreateRoutedTransport(const char **types,
|
||||||
nsIProxyInfo *proxyInfo,
|
nsIProxyInfo *proxyInfo,
|
||||||
nsISocketTransport **result)
|
nsISocketTransport **result)
|
||||||
{
|
{
|
||||||
// Check FlyWeb table for host mappings. If one exists, then use that.
|
|
||||||
RefPtr<mozilla::dom::FlyWebService> fws =
|
|
||||||
mozilla::dom::FlyWebService::GetExisting();
|
|
||||||
if (fws) {
|
|
||||||
nsresult rv = fws->CreateTransportForHost(types, typeCount, host, port,
|
|
||||||
hostRoute, portRoute,
|
|
||||||
proxyInfo, result);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (*result) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
|
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||||
NS_ENSURE_TRUE(port >= 0 && port <= 0xFFFF, NS_ERROR_ILLEGAL_VALUE);
|
NS_ENSURE_TRUE(port >= 0 && port <= 0xFFFF, NS_ERROR_ILLEGAL_VALUE);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@
|
||||||
toolkit.jar:
|
toolkit.jar:
|
||||||
content/global/alerts/alert.css (resources/content/alert.css)
|
content/global/alerts/alert.css (resources/content/alert.css)
|
||||||
content/global/alerts/alert.xul (resources/content/alert.xul)
|
content/global/alerts/alert.xul (resources/content/alert.xul)
|
||||||
content/global/alerts/alert.js (resources/content/alert.js)
|
* content/global/alerts/alert.js (resources/content/alert.js)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -26,10 +25,15 @@ const NS_ALERT_HORIZONTAL = 1;
|
||||||
const NS_ALERT_LEFT = 2;
|
const NS_ALERT_LEFT = 2;
|
||||||
const NS_ALERT_TOP = 4;
|
const NS_ALERT_TOP = 4;
|
||||||
|
|
||||||
const WINDOW_MARGIN = AppConstants.platform == "win" ? 0 : 10;
|
#ifdef XP_WIN
|
||||||
const BODY_TEXT_LIMIT = 200;
|
const WINDOW_MARGIN = 0;
|
||||||
const WINDOW_SHADOW_SPREAD = AppConstants.platform == "win" ? 10 : 0;
|
const WINDOW_SHADOW_SPREAD = 10;
|
||||||
|
#else
|
||||||
|
const WINDOW_MARGIN = 10;
|
||||||
|
const WINDOW_SHADOW_SPREAD = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BODY_TEXT_LIMIT = 200;
|
||||||
|
|
||||||
var gOrigin = 0; // Default value: alert from bottom right.
|
var gOrigin = 0; // Default value: alert from bottom right.
|
||||||
var gReplacedWindow = null;
|
var gReplacedWindow = null;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
function AppPicker() {}
|
function AppPicker() {}
|
||||||
|
|
||||||
AppPicker.prototype =
|
AppPicker.prototype =
|
||||||
|
|
@ -115,19 +113,19 @@ AppPicker.prototype =
|
||||||
* Retrieve the pretty description from the file
|
* Retrieve the pretty description from the file
|
||||||
*/
|
*/
|
||||||
getFileDisplayName: function getFileDisplayName(file) {
|
getFileDisplayName: function getFileDisplayName(file) {
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
if (file instanceof Components.interfaces.nsILocalFileWin) {
|
if (file instanceof Components.interfaces.nsILocalFileWin) {
|
||||||
try {
|
try {
|
||||||
return file.getVersionInfoField("FileDescription");
|
return file.getVersionInfoField("FileDescription");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
} else if (AppConstants.platform == "macosx") {
|
#elifdef XP_MACOSX
|
||||||
if (file instanceof Components.interfaces.nsILocalFileMac) {
|
if (file instanceof Components.interfaces.nsILocalFileMac) {
|
||||||
try {
|
try {
|
||||||
return file.bundleDisplayName;
|
return file.bundleDisplayName;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
return file.leafName;
|
return file.leafName;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -183,13 +181,13 @@ AppPicker.prototype =
|
||||||
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
|
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||||
.getService(Components.interfaces.nsIProperties);
|
.getService(Components.interfaces.nsIProperties);
|
||||||
var startLocation;
|
var startLocation;
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
startLocation = "ProgF"; // Program Files
|
startLocation = "ProgF"; // Program Files
|
||||||
} else if (AppConstants.platform == "macosx") {
|
#elifdef XP_MACOSX
|
||||||
startLocation = "LocApp"; // Local Applications
|
startLocation = "LocApp"; // Local Applications
|
||||||
} else {
|
#else
|
||||||
startLocation = "Home";
|
startLocation = "Home";
|
||||||
}
|
#endif
|
||||||
fp.displayDirectory =
|
fp.displayDirectory =
|
||||||
fileLoc.get(startLocation, Components.interfaces.nsILocalFile);
|
fileLoc.get(startLocation, Components.interfaces.nsILocalFile);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
toolkit.jar:
|
toolkit.jar:
|
||||||
content/global/appPicker.xul (content/appPicker.xul)
|
content/global/appPicker.xul (content/appPicker.xul)
|
||||||
content/global/appPicker.js (content/appPicker.js)
|
* content/global/appPicker.js (content/appPicker.js)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
|
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
|
||||||
"resource://gre/modules/AsyncShutdown.jsm");
|
"resource://gre/modules/AsyncShutdown.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask",
|
XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask",
|
||||||
"resource://gre/modules/DeferredTask.jsm");
|
"resource://gre/modules/DeferredTask.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
|
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
|
||||||
|
|
@ -696,8 +695,11 @@ this.DownloadIntegration = {
|
||||||
fileExtension = match[1];
|
fileExtension = match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
let isWindowsExe = AppConstants.platform == "win" &&
|
#ifdef XP_WIN
|
||||||
fileExtension.toLowerCase() == "exe";
|
let isWindowsExe = fileExtension.toLowerCase() == "exe";
|
||||||
|
#else
|
||||||
|
let isWindowsExe = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Ask for confirmation if the file is executable, except for .exe on
|
// Ask for confirmation if the file is executable, except for .exe on
|
||||||
// Windows where the operating system will show the prompt based on the
|
// Windows where the operating system will show the prompt based on the
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ const Cu = Components.utils;
|
||||||
const Cr = Components.results;
|
const Cr = Components.results;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||||
"resource://gre/modules/osfile.jsm");
|
"resource://gre/modules/osfile.jsm");
|
||||||
|
|
@ -186,17 +185,17 @@ this.DownloadPrompter.prototype = {
|
||||||
switch (aPromptType) {
|
switch (aPromptType) {
|
||||||
case this.ON_QUIT:
|
case this.ON_QUIT:
|
||||||
title = s.quitCancelDownloadsAlertTitle;
|
title = s.quitCancelDownloadsAlertTitle;
|
||||||
if (AppConstants.platform != "macosx") {
|
#ifdef XP_MACOSX
|
||||||
message = aDownloadsCount > 1
|
|
||||||
? s.quitCancelDownloadsAlertMsgMultiple(aDownloadsCount)
|
|
||||||
: s.quitCancelDownloadsAlertMsg;
|
|
||||||
cancelButton = s.dontQuitButtonWin;
|
|
||||||
} else {
|
|
||||||
message = aDownloadsCount > 1
|
message = aDownloadsCount > 1
|
||||||
? s.quitCancelDownloadsAlertMsgMacMultiple(aDownloadsCount)
|
? s.quitCancelDownloadsAlertMsgMacMultiple(aDownloadsCount)
|
||||||
: s.quitCancelDownloadsAlertMsgMac;
|
: s.quitCancelDownloadsAlertMsgMac;
|
||||||
cancelButton = s.dontQuitButtonMac;
|
cancelButton = s.dontQuitButtonMac;
|
||||||
}
|
#else
|
||||||
|
message = aDownloadsCount > 1
|
||||||
|
? s.quitCancelDownloadsAlertMsgMultiple(aDownloadsCount)
|
||||||
|
: s.quitCancelDownloadsAlertMsg;
|
||||||
|
cancelButton = s.dontQuitButtonWin;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case this.ON_OFFLINE:
|
case this.ON_OFFLINE:
|
||||||
title = s.offlineCancelDownloadsAlertTitle;
|
title = s.offlineCancelDownloadsAlertTitle;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ EXTRA_JS_MODULES += [
|
||||||
'DownloadList.jsm',
|
'DownloadList.jsm',
|
||||||
'Downloads.jsm',
|
'Downloads.jsm',
|
||||||
'DownloadStore.jsm',
|
'DownloadStore.jsm',
|
||||||
'DownloadUIHelper.jsm',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_PP_JS_MODULES += [
|
EXTRA_PP_JS_MODULES += [
|
||||||
'DownloadIntegration.jsm',
|
'DownloadIntegration.jsm',
|
||||||
|
'DownloadUIHelper.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,14 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = ["OSCrypto"];
|
this.EXPORTED_SYMBOLS = ["OSCrypto"];
|
||||||
|
|
||||||
var OSCrypto = {};
|
var OSCrypto = {};
|
||||||
|
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this);
|
Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this);
|
||||||
} else {
|
#else
|
||||||
throw new Error("OSCrypto.jsm isn't supported on this platform");
|
throw new Error("OSCrypto.jsm isn't supported on this platform");
|
||||||
}
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
/** * =================== SAVED SIGNONS CODE =================== ***/
|
/** * =================== SAVED SIGNONS CODE =================== ***/
|
||||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
|
@ -486,9 +485,13 @@ function HandleSignonKeyPress(e) {
|
||||||
if (signonsTree.getAttribute("editing")) {
|
if (signonsTree.getAttribute("editing")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
if (e.keyCode == KeyboardEvent.DOM_VK_DELETE ||
|
if (e.keyCode == KeyboardEvent.DOM_VK_DELETE ||
|
||||||
(AppConstants.platform == "macosx" &&
|
e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE) {
|
||||||
e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) {
|
#else
|
||||||
|
if (e.keyCode == KeyboardEvent.DOM_VK_DELETE) {
|
||||||
|
#endif
|
||||||
DeleteSignon();
|
DeleteSignon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ XPIDL_MODULE = 'loginmgr'
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'crypto-SDR.js',
|
'crypto-SDR.js',
|
||||||
'nsLoginInfo.js',
|
'nsLoginInfo.js',
|
||||||
'nsLoginManager.js',
|
|
||||||
'nsLoginManagerPrompter.js',
|
'nsLoginManagerPrompter.js',
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_PP_COMPONENTS += [
|
EXTRA_PP_COMPONENTS += [
|
||||||
|
'nsLoginManager.js',
|
||||||
'passwordmgr.manifest',
|
'passwordmgr.manifest',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -46,9 +46,10 @@ EXTRA_JS_MODULES += [
|
||||||
'LoginManagerContent.jsm',
|
'LoginManagerContent.jsm',
|
||||||
'LoginManagerParent.jsm',
|
'LoginManagerParent.jsm',
|
||||||
'LoginRecipes.jsm',
|
'LoginRecipes.jsm',
|
||||||
'OSCrypto.jsm',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_JS_MODULES += ['OSCrypto.jsm']
|
||||||
|
|
||||||
if CONFIG['OS_TARGET'] == 'Android':
|
if CONFIG['OS_TARGET'] == 'Android':
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'storage-mozStorage.js',
|
'storage-mozStorage.js',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||||
|
|
||||||
const PERMISSION_SAVE_LOGINS = "login-saving";
|
const PERMISSION_SAVE_LOGINS = "login-saving";
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/Timer.jsm");
|
Cu.import("resource://gre/modules/Timer.jsm");
|
||||||
|
|
@ -113,12 +112,12 @@ LoginManager.prototype = {
|
||||||
|
|
||||||
|
|
||||||
_initStorage() {
|
_initStorage() {
|
||||||
let contractID;
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
if (AppConstants.platform == "android") {
|
let contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
|
||||||
contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
|
#else
|
||||||
} else {
|
let contractID = "@mozilla.org/login-manager/storage/json;1";
|
||||||
contractID = "@mozilla.org/login-manager/storage/json;1";
|
#endif
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
let catMan = Cc["@mozilla.org/categorymanager;1"].
|
let catMan = Cc["@mozilla.org/categorymanager;1"].
|
||||||
getService(Ci.nsICategoryManager);
|
getService(Ci.nsICategoryManager);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||||
Cu.importGlobalProperties(["URL"]);
|
Cu.importGlobalProperties(["URL"]);
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||||
"resource://gre/modules/Services.jsm");
|
"resource://gre/modules/Services.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||||
|
|
@ -64,7 +63,11 @@ const MIN_TRANSACTIONS_FOR_BATCH = 5;
|
||||||
// On Mac OSX, the transferable system converts "\r\n" to "\n\n", where
|
// On Mac OSX, the transferable system converts "\r\n" to "\n\n", where
|
||||||
// we really just want "\n". On other platforms, the transferable system
|
// we really just want "\n". On other platforms, the transferable system
|
||||||
// converts "\r\n" to "\n".
|
// converts "\r\n" to "\n".
|
||||||
const NEWLINE = AppConstants.platform == "macosx" ? "\n" : "\r\n";
|
#ifdef XP_MACOSX
|
||||||
|
const NEWLINE = "\n";
|
||||||
|
#else
|
||||||
|
const NEWLINE = "\r\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
function QI_node(aNode, aIID) {
|
function QI_node(aNode, aIID) {
|
||||||
var result = null;
|
var result = null;
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,10 @@ if CONFIG['MOZ_PLACES']:
|
||||||
'PlacesSearchAutocompleteProvider.jsm',
|
'PlacesSearchAutocompleteProvider.jsm',
|
||||||
'PlacesSyncUtils.jsm',
|
'PlacesSyncUtils.jsm',
|
||||||
'PlacesTransactions.jsm',
|
'PlacesTransactions.jsm',
|
||||||
'PlacesUtils.jsm',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_JS_MODULES += ['PlacesUtils.jsm']
|
||||||
|
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'ColorAnalyzer.js',
|
'ColorAnalyzer.js',
|
||||||
'nsLivemarkService.js',
|
'nsLivemarkService.js',
|
||||||
|
|
|
||||||
|
|
@ -161,10 +161,14 @@
|
||||||
|
|
||||||
let $ = id => document.getAnonymousElementByAttribute(this, "anonid", id);
|
let $ = id => document.getAnonymousElementByAttribute(this, "anonid", id);
|
||||||
let ltr = document.documentElement.matches(":root:-moz-locale-dir(ltr)");
|
let ltr = document.documentElement.matches(":root:-moz-locale-dir(ltr)");
|
||||||
|
#ifdef XP_WIN
|
||||||
// Windows 7 doesn't support ⏮ and ⏭ by default, and fallback doesn't
|
// Windows 7 doesn't support ⏮ and ⏭ by default, and fallback doesn't
|
||||||
// always work (bug 1343330).
|
// always work (bug 1343330).
|
||||||
let {AppConstants} = Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
|
let useCompatCharacters = Services.vc.compare(Services.sysinfo.getProperty("version"), "6.1") <= 0;
|
||||||
let useCompatCharacters = AppConstants.isPlatformAndVersionAtMost("win", "6.1");
|
#else
|
||||||
|
let useCompatCharacters = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
let leftEnd = useCompatCharacters ? "⏪" : "⏮";
|
let leftEnd = useCompatCharacters ? "⏪" : "⏮";
|
||||||
let rightEnd = useCompatCharacters ? "⏩" : "⏭";
|
let rightEnd = useCompatCharacters ? "⏩" : "⏭";
|
||||||
$("navigateHome").label = ltr ? leftEnd : rightEnd;
|
$("navigateHome").label = ltr ? leftEnd : rightEnd;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ toolkit.jar:
|
||||||
#endif
|
#endif
|
||||||
content/global/printPageSetup.js (content/printPageSetup.js)
|
content/global/printPageSetup.js (content/printPageSetup.js)
|
||||||
content/global/printPageSetup.xul (content/printPageSetup.xul)
|
content/global/printPageSetup.xul (content/printPageSetup.xul)
|
||||||
content/global/printPreviewBindings.xml (content/printPreviewBindings.xml)
|
* content/global/printPreviewBindings.xml (content/printPreviewBindings.xml)
|
||||||
content/global/printPreviewProgress.js (content/printPreviewProgress.js)
|
content/global/printPreviewProgress.js (content/printPreviewProgress.js)
|
||||||
content/global/printPreviewProgress.xul (content/printPreviewProgress.xul)
|
content/global/printPreviewProgress.xul (content/printPreviewProgress.xul)
|
||||||
content/global/printProgress.js (content/printProgress.js)
|
content/global/printProgress.js (content/printProgress.js)
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ const Cr = Components.results;
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "uuidService",
|
XPCOMUtils.defineLazyServiceGetter(this, "uuidService",
|
||||||
"@mozilla.org/uuid-generator;1",
|
"@mozilla.org/uuid-generator;1",
|
||||||
|
|
@ -102,7 +101,11 @@ const DAY_IN_MS = 86400000; // 1 day in milliseconds
|
||||||
const MAX_SEARCH_TOKENS = 10;
|
const MAX_SEARCH_TOKENS = 10;
|
||||||
const NOOP = function noop() {};
|
const NOOP = function noop() {};
|
||||||
|
|
||||||
var supportsDeletedTable = AppConstants.platform == "android";
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
var supportsDeletedTable = true;
|
||||||
|
#else
|
||||||
|
var supportsDeletedTable = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
var Prefs = {
|
var Prefs = {
|
||||||
initialized: false,
|
initialized: false,
|
||||||
|
|
|
||||||
|
|
@ -28,17 +28,19 @@ LOCAL_INCLUDES += [
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'FormHistoryStartup.js',
|
'FormHistoryStartup.js',
|
||||||
'nsFormAutoComplete.js',
|
'nsFormAutoComplete.js',
|
||||||
'nsFormHistory.js',
|
|
||||||
'nsInputListAutoComplete.js',
|
'nsInputListAutoComplete.js',
|
||||||
'satchel.manifest',
|
'satchel.manifest',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_COMPONENTS += ['nsFormHistory.js']
|
||||||
|
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'AutoCompletePopup.jsm',
|
'AutoCompletePopup.jsm',
|
||||||
'FormHistory.jsm',
|
|
||||||
'nsFormAutoCompleteResult.jsm',
|
'nsFormAutoCompleteResult.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_JS_MODULES += ['FormHistory.jsm']
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
|
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
|
||||||
"resource://gre/modules/Deprecated.jsm");
|
"resource://gre/modules/Deprecated.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
const DB_VERSION = 4;
|
const DB_VERSION = 4;
|
||||||
const DAY_IN_MS = 86400000; // 1 day in milliseconds
|
const DAY_IN_MS = 86400000; // 1 day in milliseconds
|
||||||
|
|
@ -351,7 +349,7 @@ FormHistory.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
moveToDeletedTable : function moveToDeletedTable(values, params) {
|
moveToDeletedTable : function moveToDeletedTable(values, params) {
|
||||||
if (AppConstants.platform == "android") {
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
this.log("Moving entries to deleted table.");
|
this.log("Moving entries to deleted table.");
|
||||||
|
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
@ -370,7 +368,7 @@ FormHistory.prototype = {
|
||||||
stmt.reset();
|
stmt.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
get dbConnection() {
|
get dbConnection() {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/Promise.jsm", this);
|
Cu.import("resource://gre/modules/Promise.jsm", this);
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
|
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
|
||||||
"resource://gre/modules/BrowserUtils.jsm");
|
"resource://gre/modules/BrowserUtils.jsm");
|
||||||
|
|
@ -72,15 +71,17 @@ this.PageThumbUtils = {
|
||||||
let windowScale = aWindow ? aWindow.devicePixelRatio : systemScale;
|
let windowScale = aWindow ? aWindow.devicePixelRatio : systemScale;
|
||||||
let scale = Math.max(systemScale, windowScale);
|
let scale = Math.max(systemScale, windowScale);
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
/** *
|
/** *
|
||||||
* On retina displays, we can sometimes go down this path
|
* On retina displays, we can sometimes go down this path
|
||||||
* without a window object. In those cases, force 2x scaling
|
* without a window object. In those cases, force 2x scaling
|
||||||
* as the system scale doesn't represent the 2x scaling
|
* as the system scale doesn't represent the 2x scaling
|
||||||
* on OS X.
|
* on OS X.
|
||||||
*/
|
*/
|
||||||
if (AppConstants.platform == "macosx" && !aWindow) {
|
if (!aWindow) {
|
||||||
scale = 2;
|
scale = 2;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** *
|
/** *
|
||||||
* THESE VALUES ARE DEFINED IN newtab.css and hard coded.
|
* THESE VALUES ARE DEFINED IN newtab.css and hard coded.
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ EXTRA_COMPONENTS += [
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'PageThumbs.jsm',
|
'PageThumbs.jsm',
|
||||||
'PageThumbsWorker.js',
|
'PageThumbsWorker.js',
|
||||||
'PageThumbUtils.jsm',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_PP_JS_MODULES += [
|
EXTRA_PP_JS_MODULES += [
|
||||||
'BackgroundPageThumbs.jsm',
|
'BackgroundPageThumbs.jsm',
|
||||||
|
'PageThumbUtils.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ const Cu = Components.utils;
|
||||||
const Cr = Components.results;
|
const Cr = Components.results;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||||
"resource://gre/modules/Services.jsm");
|
"resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
|
@ -177,7 +176,7 @@ var DownloadTaskbarProgressUpdater =
|
||||||
*/
|
*/
|
||||||
_setActiveWindow: function DTPU_setActiveWindow(aWindow, aIsDownloadWindow)
|
_setActiveWindow: function DTPU_setActiveWindow(aWindow, aIsDownloadWindow)
|
||||||
{
|
{
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
// Clear out the taskbar for the old active window. (If there was no active
|
// Clear out the taskbar for the old active window. (If there was no active
|
||||||
// window, this is a no-op.)
|
// window, this is a no-op.)
|
||||||
this._clearTaskbar();
|
this._clearTaskbar();
|
||||||
|
|
@ -203,7 +202,7 @@ var DownloadTaskbarProgressUpdater =
|
||||||
else {
|
else {
|
||||||
this._activeTaskbarProgress = null;
|
this._activeTaskbarProgress = null;
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// / Current state displayed on the active window's taskbar item
|
// / Current state displayed on the active window's taskbar item
|
||||||
|
|
@ -213,14 +212,15 @@ var DownloadTaskbarProgressUpdater =
|
||||||
|
|
||||||
_shouldSetState: function DTPU_shouldSetState()
|
_shouldSetState: function DTPU_shouldSetState()
|
||||||
{
|
{
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
// If the active window is not the download manager window, set the state
|
// If the active window is not the download manager window, set the state
|
||||||
// only if it is normal or indeterminate.
|
// only if it is normal or indeterminate.
|
||||||
return this._activeWindowIsDownloadWindow ||
|
return this._activeWindowIsDownloadWindow ||
|
||||||
(this._taskbarState == Ci.nsITaskbarProgress.STATE_NORMAL ||
|
(this._taskbarState == Ci.nsITaskbarProgress.STATE_NORMAL ||
|
||||||
this._taskbarState == Ci.nsITaskbarProgress.STATE_INDETERMINATE);
|
this._taskbarState == Ci.nsITaskbarProgress.STATE_INDETERMINATE);
|
||||||
}
|
#else
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ var Cu = Components.utils;
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/DownloadUtils.jsm");
|
Cu.import("resource://gre/modules/DownloadUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||||
"resource://gre/modules/PluralForm.jsm");
|
"resource://gre/modules/PluralForm.jsm");
|
||||||
|
|
@ -253,7 +252,7 @@ function openDownload(aDownload)
|
||||||
dontAsk = !pref.getBoolPref(PREF_BDM_CONFIRMOPENEXE);
|
dontAsk = !pref.getBoolPref(PREF_BDM_CONFIRMOPENEXE);
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
|
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
// On Vista and above, we rely on native security prompting for
|
// On Vista and above, we rely on native security prompting for
|
||||||
// downloaded content unless it's disabled.
|
// downloaded content unless it's disabled.
|
||||||
try {
|
try {
|
||||||
|
|
@ -264,7 +263,7 @@ function openDownload(aDownload)
|
||||||
dontAsk = true;
|
dontAsk = true;
|
||||||
}
|
}
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if (!dontAsk) {
|
if (!dontAsk) {
|
||||||
var strings = document.getElementById("downloadStrings");
|
var strings = document.getElementById("downloadStrings");
|
||||||
|
|
@ -478,10 +477,11 @@ var gDownloadObserver = {
|
||||||
removeFromView(dl);
|
removeFromView(dl);
|
||||||
break;
|
break;
|
||||||
case "browser-lastwindow-close-granted":
|
case "browser-lastwindow-close-granted":
|
||||||
if (AppConstants.platform != "macosx" &&
|
#ifndef XP_MACOSX
|
||||||
gDownloadManager.activeDownloadCount == 0) {
|
if (gDownloadManager.activeDownloadCount == 0) {
|
||||||
setTimeout(gCloseDownloadManager, 0);
|
setTimeout(gCloseDownloadManager, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ toolkit.jar:
|
||||||
% content mozapps %content/mozapps/
|
% content mozapps %content/mozapps/
|
||||||
* content/mozapps/downloads/unknownContentType.xul (content/unknownContentType.xul)
|
* content/mozapps/downloads/unknownContentType.xul (content/unknownContentType.xul)
|
||||||
* content/mozapps/downloads/downloads.xul (content/downloads.xul)
|
* content/mozapps/downloads/downloads.xul (content/downloads.xul)
|
||||||
content/mozapps/downloads/downloads.js (content/downloads.js)
|
* content/mozapps/downloads/downloads.js (content/downloads.js)
|
||||||
content/mozapps/downloads/DownloadProgressListener.js (content/DownloadProgressListener.js)
|
content/mozapps/downloads/DownloadProgressListener.js (content/DownloadProgressListener.js)
|
||||||
content/mozapps/downloads/downloads.css (content/downloads.css)
|
content/mozapps/downloads/downloads.css (content/downloads.css)
|
||||||
content/mozapps/downloads/download.xml (content/download.xml)
|
content/mozapps/downloads/download.xml (content/download.xml)
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ EXTRA_PP_COMPONENTS += [
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'DownloadLastDir.jsm',
|
'DownloadLastDir.jsm',
|
||||||
'DownloadPaths.jsm',
|
'DownloadPaths.jsm',
|
||||||
'DownloadTaskbarProgress.jsm',
|
|
||||||
'DownloadUtils.jsm',
|
'DownloadUtils.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_JS_MODULES += ['DownloadTaskbarProgress.jsm']
|
||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
const {utils: Cu, interfaces: Ci, classes: Cc, results: Cr} = Components;
|
const {utils: Cu, interfaces: Ci, classes: Cc, results: Cr} = Components;
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "EnableDelayHelper",
|
XPCOMUtils.defineLazyModuleGetter(this, "EnableDelayHelper",
|
||||||
"resource://gre/modules/SharedPromptUtils.jsm");
|
"resource://gre/modules/SharedPromptUtils.jsm");
|
||||||
|
|
@ -408,7 +407,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
// is now caught properly in the caller of validateLeafName.
|
// is now caught properly in the caller of validateLeafName.
|
||||||
var createdFile = DownloadPaths.createNiceUniqueFile(aLocalFolder);
|
var createdFile = DownloadPaths.createNiceUniqueFile(aLocalFolder);
|
||||||
|
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
let ext;
|
let ext;
|
||||||
try {
|
try {
|
||||||
// We can fail here if there's no primary extension set
|
// We can fail here if there's no primary extension set
|
||||||
|
|
@ -423,7 +422,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
aLocalFolder.leafName = leaf + ext;
|
aLocalFolder.leafName = leaf + ext;
|
||||||
createdFile = DownloadPaths.createNiceUniqueFile(aLocalFolder);
|
createdFile = DownloadPaths.createNiceUniqueFile(aLocalFolder);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return createdFile;
|
return createdFile;
|
||||||
},
|
},
|
||||||
|
|
@ -639,8 +638,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
|
|
||||||
// Returns true if opening the default application makes sense.
|
// Returns true if opening the default application makes sense.
|
||||||
openWithDefaultOK: function() {
|
openWithDefaultOK: function() {
|
||||||
// The checking is different on Windows...
|
#ifdef XP_WIN
|
||||||
if (AppConstants.platform == "win") {
|
|
||||||
// Windows presents some special cases.
|
// Windows presents some special cases.
|
||||||
// We need to prevent use of "system default" when the file is
|
// We need to prevent use of "system default" when the file is
|
||||||
// executable (so the user doesn't launch nasty programs downloaded
|
// executable (so the user doesn't launch nasty programs downloaded
|
||||||
|
|
@ -650,11 +648,12 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
|
|
||||||
// Default is Ok if the file isn't executable (and vice-versa).
|
// Default is Ok if the file isn't executable (and vice-versa).
|
||||||
return !this.mLauncher.targetFileIsExecutable;
|
return !this.mLauncher.targetFileIsExecutable;
|
||||||
}
|
#else
|
||||||
// On other platforms, default is Ok if there is a default app.
|
// On other platforms, default is Ok if there is a default app.
|
||||||
// Note that nsIMIMEInfo providers need to ensure that this holds true
|
// Note that nsIMIMEInfo providers need to ensure that this holds true
|
||||||
// on each platform.
|
// on each platform.
|
||||||
return this.mLauncher.MIMEInfo.hasDefaultHandler;
|
return this.mLauncher.MIMEInfo.hasDefaultHandler;
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set "default" application description field.
|
// Set "default" application description field.
|
||||||
|
|
@ -675,10 +674,11 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
|
|
||||||
// getPath:
|
// getPath:
|
||||||
getPath: function (aFile) {
|
getPath: function (aFile) {
|
||||||
if (AppConstants.platform == "macosx") {
|
#ifdef XP_MACOSX
|
||||||
return aFile.leafName || aFile.path;
|
return aFile.leafName || aFile.path;
|
||||||
}
|
#else
|
||||||
return aFile.path;
|
return aFile.path;
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// initAppAndSaveToDiskValues:
|
// initAppAndSaveToDiskValues:
|
||||||
|
|
@ -980,19 +980,20 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
// Retrieve the pretty description from the file
|
// Retrieve the pretty description from the file
|
||||||
getFileDisplayName: function getFileDisplayName(file)
|
getFileDisplayName: function getFileDisplayName(file)
|
||||||
{
|
{
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
if (file instanceof Components.interfaces.nsILocalFileWin) {
|
if (file instanceof Components.interfaces.nsILocalFileWin) {
|
||||||
try {
|
try {
|
||||||
return file.getVersionInfoField("FileDescription");
|
return file.getVersionInfoField("FileDescription");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
} else if (AppConstants.platform == "macosx") {
|
#elifdef XP_MACOSX
|
||||||
if (file instanceof Components.interfaces.nsILocalFileMac) {
|
if (file instanceof Components.interfaces.nsILocalFileMac) {
|
||||||
try {
|
try {
|
||||||
return file.bundleDisplayName;
|
return file.bundleDisplayName;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return file.leafName;
|
return file.leafName;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1006,10 +1007,11 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
var otherHandler = this.dialogElement("otherHandler");
|
var otherHandler = this.dialogElement("otherHandler");
|
||||||
otherHandler.removeAttribute("hidden");
|
otherHandler.removeAttribute("hidden");
|
||||||
otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable));
|
otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable));
|
||||||
if (AppConstants.platform == "win")
|
#ifdef XP_WIN
|
||||||
otherHandler.label = this.getFileDisplayName(this.chosenApp.executable);
|
otherHandler.label = this.getFileDisplayName(this.chosenApp.executable);
|
||||||
else
|
#else
|
||||||
otherHandler.label = this.chosenApp.name;
|
otherHandler.label = this.chosenApp.name;
|
||||||
|
#endif
|
||||||
this.dialogElement("openHandler").selectedIndex = 1;
|
this.dialogElement("openHandler").selectedIndex = 1;
|
||||||
this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler");
|
this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler");
|
||||||
|
|
||||||
|
|
@ -1025,7 +1027,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
},
|
},
|
||||||
// chooseApp: Open file picker and prompt user for application.
|
// chooseApp: Open file picker and prompt user for application.
|
||||||
chooseApp: function() {
|
chooseApp: function() {
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
// Protect against the lack of an extension
|
// Protect against the lack of an extension
|
||||||
var fileExtension = "";
|
var fileExtension = "";
|
||||||
try {
|
try {
|
||||||
|
|
@ -1067,8 +1069,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
// Remember the file they chose to run.
|
// Remember the file they chose to run.
|
||||||
this.chosenApp = params.handlerApp;
|
this.chosenApp = params.handlerApp;
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
else {
|
|
||||||
#if MOZ_WIDGET_GTK == 3
|
#if MOZ_WIDGET_GTK == 3
|
||||||
var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser;
|
var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser;
|
||||||
var appChooser = Components.classes["@mozilla.org/applicationchooser;1"]
|
var appChooser = Components.classes["@mozilla.org/applicationchooser;1"]
|
||||||
|
|
@ -1103,6 +1104,7 @@ nsUnknownContentTypeDialog.prototype = {
|
||||||
this.chosenApp = localHandlerApp;
|
this.chosenApp = localHandlerApp;
|
||||||
}
|
}
|
||||||
#endif // MOZ_WIDGET_GTK == 3
|
#endif // MOZ_WIDGET_GTK == 3
|
||||||
|
#endif // XP_WIN
|
||||||
}
|
}
|
||||||
this.finishChooseApp();
|
this.finishChooseApp();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ this.EXPORTED_SYMBOLS = [ "EME_ADOBE_ID",
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
// GMP IDs
|
// GMP IDs
|
||||||
const OPEN_H264_ID = "gmp-gmpopenh264";
|
const OPEN_H264_ID = "gmp-gmpopenh264";
|
||||||
|
|
@ -73,24 +72,32 @@ this.GMPUtils = {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (aPlugin.id == EME_ADOBE_ID) {
|
if (aPlugin.id == EME_ADOBE_ID) {
|
||||||
|
#if defined(XP_WIN)
|
||||||
// Windows Vista and later only supported by Adobe EME.
|
// Windows Vista and later only supported by Adobe EME.
|
||||||
return AppConstants.isPlatformAndVersionAtLeast("win", "6");
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
} else if (aPlugin.id == WIDEVINE_ID) {
|
} else if (aPlugin.id == WIDEVINE_ID) {
|
||||||
|
|
||||||
|
#if defined(XP_WIN) || defined(XP_LINUX) || defined(XP_MACOSX)
|
||||||
// The Widevine plugin is available for Windows versions Vista and later,
|
// The Widevine plugin is available for Windows versions Vista and later,
|
||||||
// Mac OSX, and Linux.
|
// Mac OSX, and Linux.
|
||||||
return AppConstants.isPlatformAndVersionAtLeast("win", "6") ||
|
return true;
|
||||||
AppConstants.platform == "macosx" ||
|
#else
|
||||||
AppConstants.platform == "linux";
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_is32bitModeMacOS: function() {
|
_is32bitModeMacOS: function() {
|
||||||
if (AppConstants.platform != "macosx") {
|
#ifdef XP_MACOSX
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Services.appinfo.XPCOMABI.split("-")[0] == "x86";
|
return Services.appinfo.XPCOMABI.split("-")[0] == "x86";
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ EXTRA_PP_COMPONENTS += [
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'ChromeManifestParser.jsm',
|
'ChromeManifestParser.jsm',
|
||||||
'DeferredSave.jsm',
|
'DeferredSave.jsm',
|
||||||
'GMPUtils.jsm',
|
|
||||||
'LightweightThemeManager.jsm',
|
'LightweightThemeManager.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_PP_JS_MODULES += [
|
EXTRA_PP_JS_MODULES += [
|
||||||
'AddonManager.jsm',
|
'AddonManager.jsm',
|
||||||
'GMPInstallManager.jsm',
|
'GMPInstallManager.jsm',
|
||||||
|
'GMPUtils.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Additional debugging info is exposed in debug builds
|
# Additional debugging info is exposed in debug builds
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@ XPIDL_SOURCES += [
|
||||||
TEST_DIRS += ['tests']
|
TEST_DIRS += ['tests']
|
||||||
|
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
'nsUpdateService.js',
|
|
||||||
'nsUpdateService.manifest',
|
'nsUpdateService.manifest',
|
||||||
'nsUpdateServiceStub.js',
|
'nsUpdateServiceStub.js',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_COMPONENTS += ['nsUpdateService.js']
|
||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
||||||
with Files('**'):
|
with Files('**'):
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
||||||
Cu.import("resource://gre/modules/FileUtils.jsm", this);
|
Cu.import("resource://gre/modules/FileUtils.jsm", this);
|
||||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||||
Cu.import("resource://gre/modules/ctypes.jsm", this);
|
Cu.import("resource://gre/modules/ctypes.jsm", this);
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm", this);
|
|
||||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||||
|
|
||||||
const UPDATESERVICE_CID = Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}");
|
const UPDATESERVICE_CID = Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}");
|
||||||
|
|
@ -219,10 +218,7 @@ function closeHandle(handle) {
|
||||||
* @return The Win32 handle to the mutex.
|
* @return The Win32 handle to the mutex.
|
||||||
*/
|
*/
|
||||||
function createMutex(aName, aAllowExisting = true) {
|
function createMutex(aName, aAllowExisting = true) {
|
||||||
if (AppConstants.platform != "win") {
|
#ifdef XP_WIN
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
const INITIAL_OWN = 1;
|
const INITIAL_OWN = 1;
|
||||||
const ERROR_ALREADY_EXISTS = 0xB7;
|
const ERROR_ALREADY_EXISTS = 0xB7;
|
||||||
let lib = ctypes.open("kernel32.dll");
|
let lib = ctypes.open("kernel32.dll");
|
||||||
|
|
@ -246,6 +242,9 @@ function createMutex(aName, aAllowExisting = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
|
#else
|
||||||
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -257,10 +256,7 @@ function createMutex(aName, aAllowExisting = true) {
|
||||||
* @return Global mutex path
|
* @return Global mutex path
|
||||||
*/
|
*/
|
||||||
function getPerInstallationMutexName(aGlobal = true) {
|
function getPerInstallationMutexName(aGlobal = true) {
|
||||||
if (AppConstants.platform != "win") {
|
#ifdef XP_WIN
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
let hasher = Cc["@mozilla.org/security/hash;1"].
|
let hasher = Cc["@mozilla.org/security/hash;1"].
|
||||||
createInstance(Ci.nsICryptoHash);
|
createInstance(Ci.nsICryptoHash);
|
||||||
hasher.init(hasher.SHA1);
|
hasher.init(hasher.SHA1);
|
||||||
|
|
@ -274,6 +270,9 @@ function getPerInstallationMutexName(aGlobal = true) {
|
||||||
|
|
||||||
hasher.update(data, data.length);
|
hasher.update(data, data.length);
|
||||||
return (aGlobal ? "Global\\" : "") + "MozillaUpdateMutex-" + hasher.finish(true);
|
return (aGlobal ? "Global\\" : "") + "MozillaUpdateMutex-" + hasher.finish(true);
|
||||||
|
#else
|
||||||
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -285,13 +284,14 @@ function getPerInstallationMutexName(aGlobal = true) {
|
||||||
* @return true if this instance holds the update mutex
|
* @return true if this instance holds the update mutex
|
||||||
*/
|
*/
|
||||||
function hasUpdateMutex() {
|
function hasUpdateMutex() {
|
||||||
if (AppConstants.platform != "win") {
|
#ifdef XP_WIN
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!gUpdateMutexHandle) {
|
if (!gUpdateMutexHandle) {
|
||||||
gUpdateMutexHandle = createMutex(getPerInstallationMutexName(true), false);
|
gUpdateMutexHandle = createMutex(getPerInstallationMutexName(true), false);
|
||||||
}
|
}
|
||||||
return !!gUpdateMutexHandle;
|
return !!gUpdateMutexHandle;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -322,10 +322,7 @@ function areDirectoryEntriesWriteable(aDir) {
|
||||||
* @return true if elevation is required, false otherwise
|
* @return true if elevation is required, false otherwise
|
||||||
*/
|
*/
|
||||||
function getElevationRequired() {
|
function getElevationRequired() {
|
||||||
if (AppConstants.platform != "macosx") {
|
#ifdef XP_MACOSX
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Recursively check that the application bundle (and its descendants) can
|
// Recursively check that the application bundle (and its descendants) can
|
||||||
// be written to.
|
// be written to.
|
||||||
|
|
@ -344,6 +341,7 @@ function getElevationRequired() {
|
||||||
}
|
}
|
||||||
LOG("getElevationRequired - able to write to application bundle, elevation " +
|
LOG("getElevationRequired - able to write to application bundle, elevation " +
|
||||||
"not required");
|
"not required");
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -355,12 +353,13 @@ function getElevationRequired() {
|
||||||
* @return true if an update can be applied, false otherwise
|
* @return true if an update can be applied, false otherwise
|
||||||
*/
|
*/
|
||||||
function getCanApplyUpdates() {
|
function getCanApplyUpdates() {
|
||||||
if (AppConstants.platform != "macosx") {
|
#ifndef XP_MACOSX
|
||||||
try {
|
try {
|
||||||
let updateTestFile = getUpdateFile([FILE_UPDATE_TEST]);
|
let updateTestFile = getUpdateFile([FILE_UPDATE_TEST]);
|
||||||
LOG("getCanApplyUpdates - testing write access " + updateTestFile.path);
|
LOG("getCanApplyUpdates - testing write access " + updateTestFile.path);
|
||||||
testWriteAccess(updateTestFile, false);
|
testWriteAccess(updateTestFile, false);
|
||||||
if (AppConstants.platform == "win") {
|
|
||||||
|
#ifdef XP_WIN
|
||||||
// Example windowsVersion: Windows XP == 5.1
|
// Example windowsVersion: Windows XP == 5.1
|
||||||
let windowsVersion = Services.sysinfo.getProperty("version");
|
let windowsVersion = Services.sysinfo.getProperty("version");
|
||||||
LOG("getCanApplyUpdates - windowsVersion = " + windowsVersion);
|
LOG("getCanApplyUpdates - windowsVersion = " + windowsVersion);
|
||||||
|
|
@ -427,13 +426,13 @@ function getCanApplyUpdates() {
|
||||||
appDirTestFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
appDirTestFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
appDirTestFile.remove(false);
|
appDirTestFile.remove(false);
|
||||||
}
|
}
|
||||||
}
|
#endif // XP_WIN
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LOG("getCanApplyUpdates - unable to apply updates. Exception: " + e);
|
LOG("getCanApplyUpdates - unable to apply updates. Exception: " + e);
|
||||||
// No write privileges to install directory
|
// No write privileges to install directory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
#endif // !XP_MACOSX
|
||||||
|
|
||||||
LOG("getCanApplyUpdates - able to apply updates");
|
LOG("getCanApplyUpdates - able to apply updates");
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -454,16 +453,18 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdatesSession", function aus_gCSUS(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let updateTestFile;
|
let updateTestFile;
|
||||||
if (AppConstants.platform == "macosx") {
|
#ifdef XP_MACOSX
|
||||||
updateTestFile = getUpdateFile([FILE_UPDATE_TEST]);
|
updateTestFile = getUpdateFile([FILE_UPDATE_TEST]);
|
||||||
} else {
|
#else
|
||||||
updateTestFile = getInstallDirRoot();
|
updateTestFile = getInstallDirRoot();
|
||||||
updateTestFile.append(FILE_UPDATE_TEST);
|
updateTestFile.append(FILE_UPDATE_TEST);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
LOG("gCanStageUpdatesSession - testing write access " +
|
LOG("gCanStageUpdatesSession - testing write access " +
|
||||||
updateTestFile.path);
|
updateTestFile.path);
|
||||||
testWriteAccess(updateTestFile, true);
|
testWriteAccess(updateTestFile, true);
|
||||||
if (AppConstants.platform != "macosx") {
|
|
||||||
|
#ifndef XP_MACOSX
|
||||||
// On all platforms except Mac, we need to test the parent directory as
|
// On all platforms except Mac, we need to test the parent directory as
|
||||||
// well, as we need to be able to move files in that directory during the
|
// well, as we need to be able to move files in that directory during the
|
||||||
// replacing step.
|
// replacing step.
|
||||||
|
|
@ -474,7 +475,7 @@ XPCOMUtils.defineLazyGetter(this, "gCanStageUpdatesSession", function aus_gCSUS(
|
||||||
updateTestFile.createUnique(Ci.nsILocalFile.DIRECTORY_TYPE,
|
updateTestFile.createUnique(Ci.nsILocalFile.DIRECTORY_TYPE,
|
||||||
FileUtils.PERMS_DIRECTORY);
|
FileUtils.PERMS_DIRECTORY);
|
||||||
updateTestFile.remove(false);
|
updateTestFile.remove(false);
|
||||||
}
|
#endif // !XP_MACOSX
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LOG("gCanStageUpdatesSession - unable to stage updates. Exception: " +
|
LOG("gCanStageUpdatesSession - unable to stage updates. Exception: " +
|
||||||
e);
|
e);
|
||||||
|
|
@ -593,10 +594,10 @@ function getAppBaseDir() {
|
||||||
*/
|
*/
|
||||||
function getInstallDirRoot() {
|
function getInstallDirRoot() {
|
||||||
let dir = getAppBaseDir();
|
let dir = getAppBaseDir();
|
||||||
if (AppConstants.platform == "macosx") {
|
#ifdef XP_MACOSX
|
||||||
// On Mac, we store the Updated.app directory inside the bundle directory.
|
// On Mac, we store the Updated.app directory inside the bundle directory.
|
||||||
dir = dir.parent.parent;
|
dir = dir.parent.parent;
|
||||||
}
|
#endif
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -879,7 +880,8 @@ function handleUpdateFailure(update, errorCode) {
|
||||||
let cancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS, 0);
|
let cancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS, 0);
|
||||||
cancelations++;
|
cancelations++;
|
||||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
|
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
|
||||||
if (AppConstants.platform == "macosx") {
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
let osxCancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
let osxCancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
|
||||||
osxCancelations++;
|
osxCancelations++;
|
||||||
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
|
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
|
||||||
|
|
@ -901,9 +903,10 @@ function handleUpdateFailure(update, errorCode) {
|
||||||
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||||
createInstance(Ci.nsIUpdatePrompt);
|
createInstance(Ci.nsIUpdatePrompt);
|
||||||
prompter.showUpdateError(update);
|
prompter.showUpdateError(update);
|
||||||
} else {
|
#else
|
||||||
writeStatusFile(getUpdatesDir(), update.state = STATE_PENDING);
|
writeStatusFile(getUpdatesDir(), update.state = STATE_PENDING);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1483,12 +1486,15 @@ UpdateService.prototype = {
|
||||||
Services.obs.removeObserver(this, topic);
|
Services.obs.removeObserver(this, topic);
|
||||||
Services.prefs.removeObserver(PREF_APP_UPDATE_LOG, this);
|
Services.prefs.removeObserver(PREF_APP_UPDATE_LOG, this);
|
||||||
|
|
||||||
if (AppConstants.platform == "win" && gUpdateMutexHandle) {
|
#ifdef XP_WIN
|
||||||
|
if (gUpdateMutexHandle) {
|
||||||
// If we hold the update mutex, let it go!
|
// If we hold the update mutex, let it go!
|
||||||
// The OS would clean this up sometime after shutdown,
|
// The OS would clean this up sometime after shutdown,
|
||||||
// but that would have no guarantee on timing.
|
// but that would have no guarantee on timing.
|
||||||
closeHandle(gUpdateMutexHandle);
|
closeHandle(gUpdateMutexHandle);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (this._retryTimer) {
|
if (this._retryTimer) {
|
||||||
this._retryTimer.cancel();
|
this._retryTimer.cancel();
|
||||||
}
|
}
|
||||||
|
|
@ -1845,7 +1851,8 @@ UpdateService.prototype = {
|
||||||
});
|
});
|
||||||
|
|
||||||
let update = minorUpdate || majorUpdate;
|
let update = minorUpdate || majorUpdate;
|
||||||
if (AppConstants.platform == "macosx" && update) {
|
#ifdef XP_MACOSX
|
||||||
|
if (update) {
|
||||||
if (getElevationRequired()) {
|
if (getElevationRequired()) {
|
||||||
let installAttemptVersion = Services.prefs.getCharPref(
|
let installAttemptVersion = Services.prefs.getCharPref(
|
||||||
PREF_APP_UPDATE_ELEVATE_VERSION,
|
PREF_APP_UPDATE_ELEVATE_VERSION,
|
||||||
|
|
@ -1895,6 +1902,7 @@ UpdateService.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return update;
|
return update;
|
||||||
},
|
},
|
||||||
|
|
@ -2890,11 +2898,11 @@ Downloader.prototype = {
|
||||||
|
|
||||||
LOG("Downloader:_verifyDownload downloaded size == expected size.");
|
LOG("Downloader:_verifyDownload downloaded size == expected size.");
|
||||||
|
|
||||||
|
#ifdef MOZ_VERIFY_MAR_SIGNATURE
|
||||||
// The hash check is not necessary when mar signatures are used to verify
|
// The hash check is not necessary when mar signatures are used to verify
|
||||||
// the downloaded mar file.
|
// the downloaded mar file.
|
||||||
if (AppConstants.MOZ_VERIFY_MAR_SIGNATURE) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
let fileStream = Cc["@mozilla.org/network/file-input-stream;1"].
|
let fileStream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||||
createInstance(Ci.nsIFileInputStream);
|
createInstance(Ci.nsIFileInputStream);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
const C = Components.classes;
|
const C = Components.classes;
|
||||||
const I = Components.interfaces;
|
const I = Components.interfaces;
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1";
|
const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1";
|
||||||
|
|
||||||
var gProfileService;
|
var gProfileService;
|
||||||
|
|
@ -118,12 +116,11 @@ function checkCurrentInput(currentInput)
|
||||||
|
|
||||||
if (!errorMessage) {
|
if (!errorMessage) {
|
||||||
finishText.className = "";
|
finishText.className = "";
|
||||||
if (AppConstants.platform == "macosx") {
|
#ifdef XP_MACOSX
|
||||||
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac");
|
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac");
|
||||||
}
|
#else
|
||||||
else {
|
|
||||||
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText");
|
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText");
|
||||||
}
|
#endif
|
||||||
canAdvance = true;
|
canAdvance = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
const C = Components.classes;
|
const C = Components.classes;
|
||||||
|
|
@ -135,8 +134,9 @@ function onProfilesKey(aEvent)
|
||||||
switch ( aEvent.keyCode )
|
switch ( aEvent.keyCode )
|
||||||
{
|
{
|
||||||
case KeyEvent.DOM_VK_BACK_SPACE:
|
case KeyEvent.DOM_VK_BACK_SPACE:
|
||||||
if (AppConstants.platform != "macosx")
|
#ifndef XP_MACOSX
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case KeyEvent.DOM_VK_DELETE:
|
case KeyEvent.DOM_VK_DELETE:
|
||||||
ConfirmDelete();
|
ConfirmDelete();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
toolkit.jar:
|
toolkit.jar:
|
||||||
content/mozapps/profile/createProfileWizard.js (content/createProfileWizard.js)
|
* content/mozapps/profile/createProfileWizard.js (content/createProfileWizard.js)
|
||||||
* content/mozapps/profile/createProfileWizard.xul (content/createProfileWizard.xul)
|
* content/mozapps/profile/createProfileWizard.xul (content/createProfileWizard.xul)
|
||||||
content/mozapps/profile/profileSelection.js (content/profileSelection.js)
|
* content/mozapps/profile/profileSelection.js (content/profileSelection.js)
|
||||||
content/mozapps/profile/profileSelection.xul (content/profileSelection.xul)
|
content/mozapps/profile/profileSelection.xul (content/profileSelection.xul)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue