mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
60e7987621
15 changed files with 79 additions and 47 deletions
|
|
@ -10,16 +10,6 @@
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
|
|
||||||
CPOWTimer::CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
|
||||||
: cx_(nullptr)
|
|
||||||
, startInterval_(0)
|
|
||||||
{
|
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
|
||||||
if (!js::GetStopwatchIsMonitoringCPOW(cx))
|
|
||||||
return;
|
|
||||||
cx_ = cx;
|
|
||||||
startInterval_ = JS_Now();
|
|
||||||
}
|
|
||||||
CPOWTimer::~CPOWTimer()
|
CPOWTimer::~CPOWTimer()
|
||||||
{
|
{
|
||||||
if (!cx_) {
|
if (!cx_) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,16 @@
|
||||||
*/
|
*/
|
||||||
class MOZ_RAII CPOWTimer final {
|
class MOZ_RAII CPOWTimer final {
|
||||||
public:
|
public:
|
||||||
explicit inline CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
explicit inline
|
||||||
|
CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : cx_(nullptr)
|
||||||
|
, startInterval_(0)
|
||||||
|
{
|
||||||
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||||
|
if (!js::GetStopwatchIsMonitoringCPOW(cx))
|
||||||
|
return;
|
||||||
|
cx_ = cx;
|
||||||
|
startInterval_ = JS_Now();
|
||||||
|
}
|
||||||
~CPOWTimer();
|
~CPOWTimer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "JavaScriptShared.h"
|
#include "JavaScriptShared.h"
|
||||||
|
#include "JavaScriptChild.h"
|
||||||
|
#include "JavaScriptParent.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/dom/CPOWManagerGetter.h"
|
#include "mozilla/dom/CPOWManagerGetter.h"
|
||||||
#include "mozilla/dom/TabChild.h"
|
#include "mozilla/dom/TabChild.h"
|
||||||
|
|
@ -16,6 +18,7 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::jsipc;
|
using namespace mozilla::jsipc;
|
||||||
|
|
||||||
IdToObjectMap::IdToObjectMap()
|
IdToObjectMap::IdToObjectMap()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include "JavaScriptLogging.h"
|
#include "JavaScriptLogging.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
|
#include "GeckoProfiler.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
|
|
@ -20,6 +21,7 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::jsipc;
|
using namespace mozilla::jsipc;
|
||||||
|
|
||||||
struct AuxCPOWData
|
struct AuxCPOWData
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ using mozilla::RangedPtr;
|
||||||
using js::intl::CallICU;
|
using js::intl::CallICU;
|
||||||
using js::intl::GetAvailableLocales;
|
using js::intl::GetAvailableLocales;
|
||||||
using js::intl::IcuLocale;
|
using js::intl::IcuLocale;
|
||||||
|
using js::intl::INITIAL_CHAR_BUFFER_SIZE;
|
||||||
using js::intl::StringsAreEqual;
|
using js::intl::StringsAreEqual;
|
||||||
|
|
||||||
/**************** RelativeTimeFormat *****************/
|
/**************** RelativeTimeFormat *****************/
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "js/Id.h"
|
#include "js/Id.h"
|
||||||
|
#include "xpc_make_class.h"
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,12 @@ using namespace mozilla;
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
using namespace xpc;
|
using namespace xpc;
|
||||||
|
|
||||||
|
using mozilla::dom::ConvertExceptionToPromise;
|
||||||
using mozilla::dom::DestroyProtoAndIfaceCache;
|
using mozilla::dom::DestroyProtoAndIfaceCache;
|
||||||
using mozilla::dom::IndexedDatabaseManager;
|
using mozilla::dom::IndexedDatabaseManager;
|
||||||
|
using mozilla::dom::RequestOrUSVString;
|
||||||
|
using mozilla::dom::RequestOrUSVStringArgument;
|
||||||
|
using mozilla::dom::RootedDictionary;
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(SandboxPrivate)
|
NS_IMPL_CYCLE_COLLECTION_CLASS(SandboxPrivate)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIDebug2.h"
|
#include "nsIDebug2.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
#include "nsIInputStream.h"
|
||||||
#include "nsIRunnable.h"
|
#include "nsIRunnable.h"
|
||||||
#include "amIAddonManager.h"
|
#include "amIAddonManager.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
#include "mozilla/dom/GeneratedAtomList.h"
|
#include "mozilla/dom/GeneratedAtomList.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/ScriptLoader.h"
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
#include "mozilla/dom/WindowBinding.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
|
|
@ -71,6 +73,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
using namespace mozilla::dom;
|
||||||
using namespace xpc;
|
using namespace xpc;
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
using mozilla::dom::PerThreadAtomCache;
|
using mozilla::dom::PerThreadAtomCache;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,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/. */
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/Preferences.h"
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
|
|
||||||
|
|
@ -23,6 +24,7 @@
|
||||||
|
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
using mozilla::dom::EncodingUtils;
|
using mozilla::dom::EncodingUtils;
|
||||||
|
using mozilla::Preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JS locale callbacks implemented by XPCOM modules. These are theoretically
|
* JS locale callbacks implemented by XPCOM modules. These are theoretically
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/XPTInterfaceInfoManager.h"
|
#include "mozilla/XPTInterfaceInfoManager.h"
|
||||||
|
#include "nsAppRunner.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
|
#include "nsJSUtils.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
|
||||||
using namespace JS;
|
using namespace JS;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "jsprf.h"
|
#include "jsprf.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
#include "nsIAddonInterposition.h"
|
#include "nsIAddonInterposition.h"
|
||||||
#include "AddonWrapper.h"
|
#include "AddonWrapper.h"
|
||||||
#include "js/Class.h"
|
#include "js/Class.h"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
#include "XPCWrapper.h"
|
#include "XPCWrapper.h"
|
||||||
|
#include "AccessCheck.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsCycleCollectionNoteRootCallback.h"
|
#include "nsCycleCollectionNoteRootCallback.h"
|
||||||
#include "nsPrincipal.h"
|
#include "nsPrincipal.h"
|
||||||
|
|
|
||||||
|
|
@ -596,21 +596,7 @@ nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
bool nsJARChannel::GetContentTypeGuess(nsACString& aResult) const {
|
||||||
nsJARChannel::GetContentType(nsACString &result)
|
|
||||||
{
|
|
||||||
// If the Jar file has not been open yet,
|
|
||||||
// We return application/x-unknown-content-type
|
|
||||||
if (!mOpened) {
|
|
||||||
result.Assign(UNKNOWN_CONTENT_TYPE);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mContentType.IsEmpty()) {
|
|
||||||
|
|
||||||
//
|
|
||||||
// generate content type and set it
|
|
||||||
//
|
|
||||||
const char *ext = nullptr, *fileName = mJarEntry.get();
|
const char *ext = nullptr, *fileName = mJarEntry.get();
|
||||||
int32_t len = mJarEntry.Length();
|
int32_t len = mJarEntry.Length();
|
||||||
|
|
||||||
|
|
@ -618,26 +604,39 @@ nsJARChannel::GetContentType(nsACString &result)
|
||||||
// mJarEntry will be empty if we're trying to display
|
// mJarEntry will be empty if we're trying to display
|
||||||
// the topmost directory in a zip, e.g. jar:foo.zip!/
|
// the topmost directory in a zip, e.g. jar:foo.zip!/
|
||||||
if (ENTRY_IS_DIRECTORY(mJarEntry)) {
|
if (ENTRY_IS_DIRECTORY(mJarEntry)) {
|
||||||
mContentType.AssignLiteral(APPLICATION_HTTP_INDEX_FORMAT);
|
aResult.AssignLiteral(APPLICATION_HTTP_INDEX_FORMAT);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// not a directory, take a guess by its extension
|
// Not a directory, take a guess by its extension
|
||||||
for (int32_t i = len - 1; i >= 0; i--) {
|
for (int32_t i = len - 1; i >= 0; i--) {
|
||||||
if (fileName[i] == '.') {
|
if (fileName[i] == '.') {
|
||||||
ext = &fileName[i + 1];
|
ext = &fileName[i + 1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ext) {
|
if (!ext) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
nsIMIMEService* mimeServ = gJarHandler->MimeService();
|
nsIMIMEService* mimeServ = gJarHandler->MimeService();
|
||||||
if (mimeServ)
|
if (!mimeServ) {
|
||||||
mimeServ->GetTypeFromExtension(nsDependentCString(ext), mContentType);
|
return false;
|
||||||
}
|
}
|
||||||
if (mContentType.IsEmpty())
|
mimeServ->GetTypeFromExtension(nsDependentCString(ext), aResult);
|
||||||
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
|
return !aResult.IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsJARChannel::GetContentType(nsACString &aResult)
|
||||||
|
{
|
||||||
|
// If the Jar file has not been open yet,
|
||||||
|
// We return application/x-unknown-content-type
|
||||||
|
if (!mOpened) {
|
||||||
|
aResult.Assign(UNKNOWN_CONTENT_TYPE);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
result = mContentType;
|
|
||||||
|
aResult = mContentType;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -655,8 +654,8 @@ nsJARChannel::SetContentType(const nsACString &aContentType)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsJARChannel::GetContentCharset(nsACString &aContentCharset)
|
nsJARChannel::GetContentCharset(nsACString &aContentCharset)
|
||||||
{
|
{
|
||||||
// If someone gives us a charset hint we should just use that charset.
|
// We behave like HTTP channels (treat this as a hint if called before open,
|
||||||
// So we don't care when this is being called.
|
// and override the charset if called after open).
|
||||||
aContentCharset = mContentCharset;
|
aContentCharset = mContentCharset;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -749,6 +748,10 @@ nsJARChannel::Open(nsIInputStream **stream)
|
||||||
|
|
||||||
input.forget(stream);
|
input.forget(stream);
|
||||||
mOpened = true;
|
mOpened = true;
|
||||||
|
// Compute the content type now.
|
||||||
|
if (!GetContentTypeGuess(mContentType)) {
|
||||||
|
mContentType.Assign(UNKNOWN_CONTENT_TYPE);
|
||||||
|
}
|
||||||
// local files are always considered safe
|
// local files are always considered safe
|
||||||
mIsUnsafe = false;
|
mIsUnsafe = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -846,6 +849,10 @@ nsJARChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
|
||||||
mLoadGroup->AddRequest(this, nullptr);
|
mLoadGroup->AddRequest(this, nullptr);
|
||||||
|
|
||||||
mOpened = true;
|
mOpened = true;
|
||||||
|
// Compute the content type now.
|
||||||
|
if (!GetContentTypeGuess(mContentType)) {
|
||||||
|
mContentType.Assign(UNKNOWN_CONTENT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ private:
|
||||||
nsresult OpenLocalFile();
|
nsresult OpenLocalFile();
|
||||||
void NotifyError(nsresult aError);
|
void NotifyError(nsresult aError);
|
||||||
void FireOnProgress(uint64_t aProgress);
|
void FireOnProgress(uint64_t aProgress);
|
||||||
|
|
||||||
|
// Returns false if we don't know the content type of this channel, in which
|
||||||
|
// case we should use the content-type hint.
|
||||||
|
bool GetContentTypeGuess(nsACString&) const;
|
||||||
|
|
||||||
virtual void OnDownloadComplete(mozilla::net::MemoryDownloader* aDownloader,
|
virtual void OnDownloadComplete(mozilla::net::MemoryDownloader* aDownloader,
|
||||||
nsIRequest* aRequest,
|
nsIRequest* aRequest,
|
||||||
nsISupports* aCtxt,
|
nsISupports* aCtxt,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue