mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Merge m-c to fx-team.
This commit is contained in:
commit
269dbe5b63
@ -68,8 +68,11 @@ TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
|
||||
|
||||
// Get the content and frame of the accessible. In the case of document
|
||||
// accessible it's role content and root frame.
|
||||
nsIContent *hyperTextElm = mHyperTextAcc->GetContent();
|
||||
nsIFrame *rootFrame = mHyperTextAcc->GetFrame();
|
||||
nsIContent* hyperTextElm = mHyperTextAcc->GetContent();
|
||||
if (!hyperTextElm)
|
||||
return; // XXX: we don't support text attrs on document with no body
|
||||
|
||||
nsIFrame* rootFrame = mHyperTextAcc->GetFrame();
|
||||
NS_ASSERTION(rootFrame, "No frame for accessible!");
|
||||
if (!rootFrame)
|
||||
return;
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>
|
||||
@ -119,7 +119,7 @@
|
||||
<!-- Flame specific things -->
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="e8a318f7690092e639ba88891606f4183e846d3f"/>
|
||||
<project name="device/qcom/common" path="device/qcom/common" revision="234ed34543345f58c0d4dcb1aa012de68802b9dc"/>
|
||||
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="2173c7c1f90ccd28915eed1d58077311d8296ec4"/>
|
||||
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="2a3f4c782daad9740f1b78766b636e0e00a0ff30"/>
|
||||
<project name="kernel/msm" path="kernel" revision="1f47f3a180ed8b070f3cf3c4d11ff2523cca6c8a"/>
|
||||
<project name="platform/bootable/recovery" path="bootable/recovery" revision="f2914eacee9120680a41463708bb6ee8291749fc"/>
|
||||
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="fa892235a9bd8983f8b591129fc1a9398f64e514"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "2c31857e31048d05f9bb335d8ef2408c612195af",
|
||||
"revision": "18441d7d35b6a96732575fb5c28cedfed8269fb2",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -57,14 +57,12 @@ relativesrcdir toolkit/locales:
|
||||
|
||||
# overrides for dom l10n, also for en-US
|
||||
relativesrcdir dom/locales:
|
||||
locale/@AB_CD@/b2g-l10n/overrides/charsetTitles.properties (%chrome/charsetTitles.properties)
|
||||
locale/@AB_CD@/b2g-l10n/overrides/global.dtd (%chrome/global.dtd)
|
||||
locale/@AB_CD@/b2g-l10n/overrides/AccessFu.properties (%chrome/accessibility/AccessFu.properties)
|
||||
locale/@AB_CD@/b2g-l10n/overrides/dom/dom.properties (%chrome/dom/dom.properties)
|
||||
#about:plugins
|
||||
locale/@AB_CD@/b2g-l10n/overrides/plugins.properties (%chrome/plugins.properties)
|
||||
|
||||
% override chrome://global/locale/charsetTitles.properties chrome://b2g-l10n/locale/overrides/charsetTitles.properties
|
||||
% override chrome://global/locale/global.dtd chrome://b2g-l10n/locale/overrides/global.dtd
|
||||
% override chrome://global/locale/AccessFu.properties chrome://b2g-l10n/locale/overrides/AccessFu.properties
|
||||
% override chrome://global/locale/dom/dom.properties chrome://b2g-l10n/locale/overrides/dom/dom.properties
|
||||
|
@ -20,9 +20,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
|
||||
"resource://gre/modules/ShortcutUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
|
||||
"resource://gre/modules/CharsetMenu.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "CharsetManager",
|
||||
"@mozilla.org/charset-converter-manager;1",
|
||||
"nsICharsetConverterManager");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "CharsetBundle", function() {
|
||||
const kCharsetBundle = "chrome://global/locale/charsetMenu.properties";
|
||||
|
@ -105,7 +105,7 @@ function test() {
|
||||
"myVar.prop + 42": 2549
|
||||
}))
|
||||
.then(() => deleteWatchExpression("myVar.prop + 42"))
|
||||
.then(() => testEdit("self", "0910", {
|
||||
.then(() => testEdit("self", "910", {
|
||||
"myVar.prop": 910
|
||||
}))
|
||||
.then(() => deleteLastWatchExpression("myVar.prop"))
|
||||
|
@ -114,7 +114,6 @@
|
||||
#include "nsIRequest.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
|
||||
#include "nsCharsetAlias.h"
|
||||
#include "nsCharsetSource.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIContentSink.h"
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -31,7 +29,6 @@
|
||||
#include "nsRange.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIParserService.h"
|
||||
@ -53,6 +50,7 @@
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -150,7 +148,6 @@ protected:
|
||||
nsCOMPtr<nsIUnicodeEncoder> mUnicodeEncoder;
|
||||
nsCOMPtr<nsINode> mCommonParent;
|
||||
nsCOMPtr<nsIDocumentEncoderNodeFixup> mNodeFixup;
|
||||
nsCOMPtr<nsICharsetConverterManager> mCharsetConverterManager;
|
||||
|
||||
nsString mMimeType;
|
||||
nsCString mCharset;
|
||||
@ -1064,12 +1061,6 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAtom> charsetAtom;
|
||||
if (!mCharset.IsEmpty()) {
|
||||
if (!mCharsetConverterManager) {
|
||||
mCharsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
bool rewriteEncodingDeclaration = !(mSelection || mRange || mNode) && !(mFlags & OutputDontRewriteEncodingDeclaration);
|
||||
mSerializer->Init(mFlags, mWrapColumn, mCharset.get(), mIsCopying, rewriteEncodingDeclaration);
|
||||
@ -1204,14 +1195,11 @@ nsDocumentEncoder::EncodeToStream(nsIOutputStream* aStream)
|
||||
if (!mDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (!mCharsetConverterManager) {
|
||||
mCharsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(mCharset, encoding)) {
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
|
||||
rv = mCharsetConverterManager->GetUnicodeEncoder(mCharset.get(),
|
||||
getter_AddRefs(mUnicodeEncoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mUnicodeEncoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
|
||||
if (mMimeType.LowerCaseEqualsLiteral("text/plain")) {
|
||||
rv = mUnicodeEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, '?');
|
||||
|
@ -232,6 +232,12 @@ function test() {
|
||||
// Reset 'required' attribute:
|
||||
elem.removeAttribute("required");
|
||||
}
|
||||
|
||||
// Test that key events are correctly dispatched
|
||||
elem.max = "";
|
||||
elem.value = "";
|
||||
sendString("7837281");
|
||||
is(elem.value, "7837281", "Test keypress event dispatch for number control");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -207,13 +207,17 @@ IsGStreamerSupportedType(const nsACString& aMimeType)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OMX_DECODER
|
||||
static const char* const gOmxTypes[7] = {
|
||||
static const char* const gOmxTypes[] = {
|
||||
"audio/mpeg",
|
||||
"audio/mp4",
|
||||
"audio/amr",
|
||||
"video/mp4",
|
||||
"video/3gpp",
|
||||
"video/quicktime",
|
||||
#ifdef MOZ_OMX_WEBM_DECODER
|
||||
"video/webm",
|
||||
"audio/webm",
|
||||
#endif
|
||||
nullptr
|
||||
};
|
||||
|
||||
@ -243,6 +247,16 @@ static char const *const gMpegAudioCodecs[2] = {
|
||||
"mp3", // MP3
|
||||
nullptr
|
||||
};
|
||||
|
||||
#ifdef MOZ_OMX_WEBM_DECODER
|
||||
static char const *const gOMXWebMCodecs[4] = {
|
||||
"vorbis",
|
||||
"vp8",
|
||||
"vp8.0",
|
||||
nullptr
|
||||
};
|
||||
#endif //MOZ_OMX_WEBM_DECODER
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_rtsp
|
||||
@ -380,7 +394,7 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
|
||||
result = CANPLAY_MAYBE;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_WEBM
|
||||
#if defined(MOZ_WEBM) && !defined(MOZ_OMX_WEBM_DECODER)
|
||||
if (IsWebMType(nsDependentCString(aMIMEType))) {
|
||||
codecList = gWebMCodecs;
|
||||
result = CANPLAY_MAYBE;
|
||||
@ -399,6 +413,11 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
|
||||
result = CANPLAY_MAYBE;
|
||||
if (nsDependentCString(aMIMEType).EqualsASCII("audio/mpeg")) {
|
||||
codecList = gMpegAudioCodecs;
|
||||
#ifdef MOZ_OMX_WEBM_DECODER
|
||||
} else if (nsDependentCString(aMIMEType).EqualsASCII("audio/webm") ||
|
||||
nsDependentCString(aMIMEType).EqualsASCII("video/webm")) {
|
||||
codecList = gOMXWebMCodecs;
|
||||
#endif
|
||||
} else {
|
||||
codecList = gH264Codecs;
|
||||
}
|
||||
|
@ -357,6 +357,7 @@ RtspMediaResource::RtspMediaResource(MediaDecoder* aDecoder,
|
||||
: BaseMediaResource(aDecoder, aChannel, aURI, aContentType)
|
||||
, mIsConnected(false)
|
||||
, mRealTime(false)
|
||||
, mIsSuspend(true)
|
||||
{
|
||||
#ifndef NECKO_PROTOCOL_rtsp
|
||||
MOZ_CRASH("Should not be called except for B2G platform");
|
||||
@ -384,6 +385,28 @@ RtspMediaResource::~RtspMediaResource()
|
||||
}
|
||||
}
|
||||
|
||||
void RtspMediaResource::SetSuspend(bool aIsSuspend)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
RTSPMLOG("SetSuspend %d",aIsSuspend);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<bool>(this, &RtspMediaResource::NotifySuspend,
|
||||
aIsSuspend);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
void RtspMediaResource::NotifySuspend(bool aIsSuspend)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
RTSPMLOG("NotifySuspend %d",aIsSuspend);
|
||||
|
||||
mIsSuspend = aIsSuspend;
|
||||
if (mDecoder) {
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
RtspMediaResource::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
@ -638,6 +661,8 @@ RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, nsresult aReason)
|
||||
void RtspMediaResource::Suspend(bool aCloseImmediately)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
|
||||
|
||||
mIsSuspend = true;
|
||||
if (NS_WARN_IF(!mDecoder)) {
|
||||
return;
|
||||
}
|
||||
@ -649,11 +674,14 @@ void RtspMediaResource::Suspend(bool aCloseImmediately)
|
||||
|
||||
mMediaStreamController->Suspend();
|
||||
element->DownloadSuspended();
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
|
||||
void RtspMediaResource::Resume()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
|
||||
|
||||
mIsSuspend = false;
|
||||
if (NS_WARN_IF(!mDecoder)) {
|
||||
return;
|
||||
}
|
||||
@ -667,6 +695,7 @@ void RtspMediaResource::Resume()
|
||||
element->DownloadResumed();
|
||||
}
|
||||
mMediaStreamController->Resume();
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
|
||||
nsresult RtspMediaResource::Open(nsIStreamListener **aStreamListener)
|
||||
|
@ -93,6 +93,10 @@ public:
|
||||
return mRealTime;
|
||||
}
|
||||
|
||||
// Called by RtspOmxReader, dispatch a runnable to notify mDecoder.
|
||||
// Other thread only.
|
||||
void SetSuspend(bool aIsSuspend);
|
||||
|
||||
// The following methods can be called on any thread except main thread.
|
||||
|
||||
// Read data from track.
|
||||
@ -137,8 +141,7 @@ public:
|
||||
virtual void Pin() MOZ_OVERRIDE {}
|
||||
virtual void Unpin() MOZ_OVERRIDE {}
|
||||
|
||||
// dummy
|
||||
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
|
||||
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return mIsSuspend; }
|
||||
|
||||
virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
|
||||
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
|
||||
@ -224,6 +227,8 @@ protected:
|
||||
nsRefPtr<Listener> mListener;
|
||||
|
||||
private:
|
||||
// Notify mDecoder the rtsp stream is suspend. Main thread only.
|
||||
void NotifySuspend(bool aIsSuspend);
|
||||
bool IsVideoEnabled();
|
||||
bool IsVideo(uint8_t tracks, nsIStreamingProtocolMetaData *meta);
|
||||
// These two members are created at |RtspMediaResource::OnConnected|.
|
||||
@ -235,6 +240,8 @@ private:
|
||||
bool mIsConnected;
|
||||
// live stream
|
||||
bool mRealTime;
|
||||
// Indicate the rtsp controller is suspended or not. Main thread only.
|
||||
bool mIsSuspend;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -188,3 +188,5 @@ DEFINES['MOZILLA_INTERNAL_API'] = True
|
||||
if CONFIG['MOZ_OMX_DECODER']:
|
||||
DEFINES['MOZ_OMX_DECODER'] = True
|
||||
|
||||
if CONFIG['ANDROID_VERSION'] > '15':
|
||||
DEFINES['MOZ_OMX_WEBM_DECODER'] = True
|
||||
|
@ -494,7 +494,11 @@ bool OmxDecoder::AllocateMediaResources()
|
||||
// is currently used, and for formats this code is currently used
|
||||
// for (h.264). So if we don't get a hardware decoder, just give
|
||||
// up.
|
||||
#ifdef MOZ_OMX_WEBM_DECODER
|
||||
int flags = 0;//fallback to omx sw decoder if there is no hw decoder
|
||||
#else
|
||||
int flags = kHardwareCodecsOnly;
|
||||
#endif//MOZ_OMX_WEBM_DECODER
|
||||
|
||||
if (isInEmulator()) {
|
||||
// If we are in emulator, allow to fall back to software.
|
||||
|
@ -322,6 +322,7 @@ void RtspOmxReader::SetIdle() {
|
||||
if (controller) {
|
||||
controller->Pause();
|
||||
}
|
||||
mRtspResource->SetSuspend(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,6 +334,7 @@ void RtspOmxReader::SetActive() {
|
||||
if (controller) {
|
||||
controller->Play();
|
||||
}
|
||||
mRtspResource->SetSuspend(false);
|
||||
}
|
||||
|
||||
// Call parent class to set OMXCodec active.
|
||||
|
@ -73,3 +73,5 @@ CXXFLAGS += [
|
||||
]
|
||||
]
|
||||
|
||||
if CONFIG['ANDROID_VERSION'] > '15':
|
||||
DEFINES['MOZ_OMX_WEBM_DECODER'] = True
|
||||
|
@ -7,9 +7,24 @@ function check_webm(v, enabled) {
|
||||
check("video/webm", "maybe");
|
||||
check("audio/webm", "maybe");
|
||||
|
||||
// Supported Webm codecs
|
||||
var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
|
||||
var audio = ['vorbis', 'opus'];
|
||||
// Since we want to use OMX webm HW acceleration to speed up vp8 decoding,
|
||||
// we enabled it after Android version 16(JB) as MOZ_OMX_WEBM_DECODER
|
||||
// defined in moz.build. More information is on Bug 986381.
|
||||
// Currently OMX (KK included) webm decoders can only support vp8 and vorbis,
|
||||
// so only vp8 and vorbis will be tested when OMX webm decoder is enabled.
|
||||
var androidVer = SpecialPowers.Cc['@mozilla.org/system-info;1']
|
||||
.getService(SpecialPowers.Ci.nsIPropertyBag2)
|
||||
.getProperty('version');
|
||||
info("android version:"+androidVer);
|
||||
//Check for FxOS case
|
||||
if (navigator.userAgent.indexOf("Mobile") != -1 &&
|
||||
navigator.userAgent.indexOf("Android") == -1 && androidVer > 15) {
|
||||
var video = ['vp8', 'vp8.0'];
|
||||
var audio = ['vorbis'];
|
||||
} else {
|
||||
var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
|
||||
var audio = ['vorbis', 'opus'];
|
||||
}
|
||||
audio.forEach(function(acodec) {
|
||||
check("audio/webm; codecs=" + acodec, "probably");
|
||||
check("video/webm; codecs=" + acodec, "probably");
|
||||
|
@ -11,7 +11,6 @@ const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
|
@ -9,6 +9,11 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/InterAppCommService.jsm");
|
||||
|
||||
const DEBUG = false;
|
||||
function debug(aMsg) {
|
||||
dump("-- InterAppCommServiceProxy: " + Date.now() + ": " + aMsg + "\n");
|
||||
}
|
||||
|
||||
function InterAppCommServiceProxy() {
|
||||
}
|
||||
|
||||
@ -20,9 +25,19 @@ InterAppCommServiceProxy.prototype = {
|
||||
aDescription, aRules);
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != "profile-after-change") {
|
||||
if (DEBUG) {
|
||||
debug("Should receive 'profile-after-change' only.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
classID: Components.ID("{3dd15ce6-e7be-11e2-82bc-77967e7a63e6}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIInterAppCommService])
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIInterAppCommService,
|
||||
Ci.nsIObserver])
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([InterAppCommServiceProxy]);
|
||||
|
@ -36,8 +36,8 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabel(aOptions.mEncoding, encoding) ||
|
||||
encoding.EqualsLiteral("replacement")) {
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aOptions.mEncoding,
|
||||
encoding)) {
|
||||
aError.ThrowTypeError(MSG_ENCODING_NOT_SUPPORTED, &aOptions.mEncoding);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2498,7 +2498,7 @@ nsDOMWindowUtils::GetParent(JS::Handle<JS::Value> aObject,
|
||||
|
||||
// Outerize if necessary.
|
||||
if (parent) {
|
||||
if (JSObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
|
||||
if (js::ObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
|
||||
parent = outerize(aCx, parent);
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,16 @@ public:
|
||||
mArenaStats.addToTabSizes(sizes);
|
||||
}
|
||||
|
||||
size_t getTotalSize() const
|
||||
{
|
||||
size_t total = 0;
|
||||
#define ADD_TO_TOTAL_SIZE(kind, mSize) total += mSize;
|
||||
FOR_EACH_SIZE(ADD_TO_TOTAL_SIZE)
|
||||
#undef ADD_TO_TOTAL_SIZE
|
||||
total += mArenaStats.getTotalSize();
|
||||
return total;
|
||||
}
|
||||
|
||||
#define DECL_SIZE(kind, mSize) size_t mSize;
|
||||
FOR_EACH_SIZE(DECL_SIZE);
|
||||
#undef DECL_SIZE
|
||||
|
@ -5,11 +5,12 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothProfileController.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
|
||||
#include "BluetoothA2dpManager.h"
|
||||
#include "BluetoothHfpManager.h"
|
||||
#include "BluetoothHidManager.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "BluetoothService.h"
|
||||
#include "BluetoothUtils.h"
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
@ -217,6 +218,11 @@ BluetoothProfileController::StartSession()
|
||||
MOZ_ASSERT(mProfilesIndex == -1);
|
||||
MOZ_ASSERT(mTimer);
|
||||
|
||||
if (!IsBtServiceAvailable()) {
|
||||
EndSession();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProfiles.Length() < 1) {
|
||||
BT_LOGR("No queued profile.");
|
||||
EndSession();
|
||||
@ -240,6 +246,12 @@ BluetoothProfileController::EndSession()
|
||||
|
||||
BT_LOGR("mSuccess %d", mSuccess);
|
||||
|
||||
// Don't have to check profile status and retrigger session after connection
|
||||
// timeout, since session is end.
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
}
|
||||
|
||||
// The action has completed, so the DOM request should be replied then invoke
|
||||
// the callback.
|
||||
if (mSuccess) {
|
||||
@ -265,6 +277,11 @@ BluetoothProfileController::Next()
|
||||
|
||||
mCurrentProfileFinished = false;
|
||||
|
||||
if (!IsBtServiceAvailable()) {
|
||||
EndSession();
|
||||
return;
|
||||
}
|
||||
|
||||
if (++mProfilesIndex >= (int)mProfiles.Length()) {
|
||||
EndSession();
|
||||
return;
|
||||
@ -279,6 +296,13 @@ BluetoothProfileController::Next()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothProfileController::IsBtServiceAvailable() const
|
||||
{
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
return (bs && bs->IsEnabled() && !bs->IsToggling());
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothProfileController::NotifyCompletion(const nsAString& aErrorStr)
|
||||
{
|
||||
@ -308,6 +332,11 @@ BluetoothProfileController::GiveupAndContinue()
|
||||
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], ERR_OPERATION_TIMEOUT);
|
||||
mProfiles[mProfilesIndex]->Reset();
|
||||
Next();
|
||||
|
||||
if (IsBtServiceAvailable()) {
|
||||
Next();
|
||||
} else {
|
||||
EndSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,9 @@ private:
|
||||
// Connect/Disconnect next profile in the array
|
||||
void Next();
|
||||
|
||||
// Is Bluetooth service available for profile connection/disconnection ?
|
||||
bool IsBtServiceAvailable() const;
|
||||
|
||||
const bool mConnect;
|
||||
nsString mDeviceAddress;
|
||||
nsRefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
|
@ -95,6 +95,14 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Bluetooth just enabled, clear profile controllers and runnable arrays.
|
||||
sControllerArray.Clear();
|
||||
sBondingRunnableArray.Clear();
|
||||
sChangeDiscoveryRunnableArray.Clear();
|
||||
sGetDeviceRunnableArray.Clear();
|
||||
sSetPropertyRunnableArray.Clear();
|
||||
sUnbondingRunnableArray.Clear();
|
||||
|
||||
// Bluetooth scan mode is NONE by default
|
||||
bt_scan_mode_t mode = BT_SCAN_MODE_CONNECTABLE;
|
||||
bt_property_t prop;
|
||||
@ -1149,8 +1157,9 @@ NextBluetoothProfileController()
|
||||
NS_ENSURE_FALSE_VOID(sControllerArray.IsEmpty());
|
||||
sControllerArray.RemoveElementAt(0);
|
||||
// Re-check if the task array is empty, if it's not, the next task will begin.
|
||||
NS_ENSURE_FALSE_VOID(sControllerArray.IsEmpty());
|
||||
sControllerArray[0]->StartSession();
|
||||
if (!sControllerArray.IsEmpty()) {
|
||||
sControllerArray[0]->StartSession();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -254,9 +254,9 @@ BrowserElementParent.prototype = {
|
||||
"hello": this._recvHello,
|
||||
"contextmenu": this._fireCtxMenuEvent,
|
||||
"locationchange": this._fireEventFromMsg,
|
||||
"loadstart": this._fireEventFromMsg,
|
||||
"loadend": this._fireEventFromMsg,
|
||||
"titlechange": this._fireEventFromMsg,
|
||||
"loadstart": this._fireProfiledEventFromMsg,
|
||||
"loadend": this._fireProfiledEventFromMsg,
|
||||
"titlechange": this._fireProfiledEventFromMsg,
|
||||
"iconchange": this._fireEventFromMsg,
|
||||
"manifestchange": this._fireEventFromMsg,
|
||||
"metachange": this._fireEventFromMsg,
|
||||
@ -267,8 +267,8 @@ BrowserElementParent.prototype = {
|
||||
"securitychange": this._fireEventFromMsg,
|
||||
"error": this._fireEventFromMsg,
|
||||
"scroll": this._fireEventFromMsg,
|
||||
"firstpaint": this._fireEventFromMsg,
|
||||
"documentfirstpaint": this._fireEventFromMsg,
|
||||
"firstpaint": this._fireProfiledEventFromMsg,
|
||||
"documentfirstpaint": this._fireProfiledEventFromMsg,
|
||||
"nextpaint": this._recvNextPaint,
|
||||
"keyevent": this._fireKeyEvent,
|
||||
"showmodalprompt": this._handleShowModalPrompt,
|
||||
@ -407,6 +407,16 @@ BrowserElementParent.prototype = {
|
||||
return !this._frameElement.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
* add profiler marker for each event fired.
|
||||
*/
|
||||
_fireProfiledEventFromMsg: function(data) {
|
||||
if (Services.profiler !== undefined) {
|
||||
Services.profiler.AddMarker(data.json.msg_name);
|
||||
}
|
||||
this._fireEventFromMsg(data);
|
||||
},
|
||||
|
||||
/**
|
||||
* Fire either a vanilla or a custom event, depending on the contents of
|
||||
* |data|.
|
||||
|
@ -66,6 +66,7 @@ skip-if = (toolkit == 'gonk' && !debug)
|
||||
skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) #TIMED_OUT, bug 766586
|
||||
[test_browserElement_oop_SendEvent.html]
|
||||
[test_browserElement_oop_SetInputMethodActive.html]
|
||||
skip-if = true # Bug 983490, bug 987928
|
||||
[test_browserElement_oop_SetVisible.html]
|
||||
[test_browserElement_oop_SetVisibleFrames.html]
|
||||
[test_browserElement_oop_SetVisibleFrames2.html]
|
||||
|
@ -170,7 +170,7 @@ skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) # android(TIMED_
|
||||
[test_browserElement_inproc_SendEvent.html]
|
||||
# The setInputMethodActive() tests will timed out on Android
|
||||
[test_browserElement_inproc_SetInputMethodActive.html]
|
||||
skip-if = (os == "android")
|
||||
skip-if = true # Bug 983490, bug 987928
|
||||
[test_browserElement_inproc_SetVisible.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames2.html]
|
||||
|
@ -15,9 +15,11 @@ const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
|
||||
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
|
||||
"resource://gre/modules/PhoneNumberUtils.jsm");
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
/* all exported symbols need to be bound to this on B2G - Bug 961777 */
|
||||
|
@ -15,8 +15,11 @@ this.EXPORTED_SYMBOLS = ["ContactService"];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm");
|
||||
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContactDB",
|
||||
"resource://gre/modules/ContactDB.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
|
||||
"resource://gre/modules/PhoneNumberUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
|
@ -17,6 +17,10 @@ static const char* labelsEncodings[][3] = {
|
||||
#include "labelsencodings.properties.h"
|
||||
};
|
||||
|
||||
static const char* encodingsGroups[][3] = {
|
||||
#include "encodingsgroups.properties.h"
|
||||
};
|
||||
|
||||
bool
|
||||
EncodingUtils::FindEncodingForLabel(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
@ -35,6 +39,20 @@ EncodingUtils::FindEncodingForLabel(const nsACString& aLabel,
|
||||
labelsEncodings, ArrayLength(labelsEncodings), label, aOutEncoding));
|
||||
}
|
||||
|
||||
bool
|
||||
EncodingUtils::FindEncodingForLabelNoReplacement(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
if(!FindEncodingForLabel(aLabel, aOutEncoding)) {
|
||||
return false;
|
||||
}
|
||||
if (aOutEncoding.EqualsLiteral("replacement")) {
|
||||
aOutEncoding.Truncate();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EncodingUtils::IsAsciiCompatible(const nsACString& aPreferredName)
|
||||
{
|
||||
@ -69,5 +87,15 @@ EncodingUtils::EncoderForEncoding(const nsACString& aEncoding)
|
||||
return encoder.forget();
|
||||
}
|
||||
|
||||
void
|
||||
EncodingUtils::LangGroupForEncoding(const nsACString& aEncoding,
|
||||
nsACString& aOutGroup)
|
||||
{
|
||||
if (NS_FAILED(nsUConvPropertySearch::SearchPropertyValue(
|
||||
encodingsGroups, ArrayLength(encodingsGroups), aEncoding, aOutGroup))) {
|
||||
aOutGroup.AssignLiteral("x-unicode");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
* our internal implementations.
|
||||
*
|
||||
* @param aLabel, incoming label describing charset to be decoded.
|
||||
* @param aRetEncoding, returning corresponding encoding for label.
|
||||
* @param aOutEncoding, returning corresponding encoding for label.
|
||||
* @return false if no encoding was found for label.
|
||||
* true if valid encoding found.
|
||||
*/
|
||||
@ -40,6 +40,25 @@ public:
|
||||
return FindEncodingForLabel(NS_ConvertUTF16toUTF8(aLabel), aOutEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like FindEncodingForLabel() except labels that map to "replacement"
|
||||
* are treated as unknown.
|
||||
*
|
||||
* @param aLabel, incoming label describing charset to be decoded.
|
||||
* @param aOutEncoding, returning corresponding encoding for label.
|
||||
* @return false if no encoding was found for label.
|
||||
* true if valid encoding found.
|
||||
*/
|
||||
static bool FindEncodingForLabelNoReplacement(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding);
|
||||
|
||||
static bool FindEncodingForLabelNoReplacement(const nsAString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
return FindEncodingForLabelNoReplacement(NS_ConvertUTF16toUTF8(aLabel),
|
||||
aOutEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any leading and trailing space characters, following the
|
||||
* definition of space characters from Encoding spec.
|
||||
@ -109,6 +128,16 @@ public:
|
||||
static already_AddRefed<nsIUnicodeEncoder>
|
||||
EncoderForEncoding(const nsACString& aEncoding);
|
||||
|
||||
/**
|
||||
* Finds a Gecko language group string (e.g. x-western) for a Gecko-canonical
|
||||
* encoding name.
|
||||
*
|
||||
* @param aEncoding, incoming label describing charset to be decoded.
|
||||
* @param aOutGroup, returning corresponding language group.
|
||||
*/
|
||||
static void LangGroupForEncoding(const nsACString& aEncoding,
|
||||
nsACString& aOutGroup);
|
||||
|
||||
private:
|
||||
EncodingUtils() MOZ_DELETE;
|
||||
};
|
||||
|
@ -11,5 +11,7 @@ localesfallbacks.properties.h: $(PROPS2ARRAYS) localesfallbacks.properties
|
||||
$(PYTHON) $^ $@
|
||||
domainsfallbacks.properties.h: $(PROPS2ARRAYS) domainsfallbacks.properties
|
||||
$(PYTHON) $^ $@
|
||||
encodingsgroups.properties.h: $(PROPS2ARRAYS) encodingsgroups.properties
|
||||
$(PYTHON) $^ $@
|
||||
nonparticipatingdomains.properties.h: $(PROPS2ARRAYS) nonparticipatingdomains.properties
|
||||
$(PYTHON) $^ $@
|
||||
|
@ -15,14 +15,12 @@ void
|
||||
TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsAutoString label(aLabel);
|
||||
EncodingUtils::TrimSpaceCharacters(label);
|
||||
|
||||
nsAutoCString encoding;
|
||||
// Let encoding be the result of getting an encoding from label.
|
||||
// If encoding is failure or replacement, throw a TypeError.
|
||||
if (!EncodingUtils::FindEncodingForLabel(label, encoding) ||
|
||||
encoding.EqualsLiteral("replacement")) {
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aLabel, encoding)) {
|
||||
nsAutoString label(aLabel);
|
||||
EncodingUtils::TrimSpaceCharacters(label);
|
||||
aRv.ThrowTypeError(MSG_ENCODING_NOT_SUPPORTED, &label);
|
||||
return;
|
||||
}
|
||||
|
43
dom/encoding/encodingsgroups.properties
Normal file
43
dom/encoding/encodingsgroups.properties
Normal file
@ -0,0 +1,43 @@
|
||||
# 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/.
|
||||
|
||||
# x-unicode is assumed for encodings not listed here
|
||||
|
||||
Big5=zh-TW
|
||||
Big5-HKSCS=zh=HK
|
||||
EUC-JP=ja
|
||||
EUC-KR=ko
|
||||
gb18030=zh-CN
|
||||
gbk=zh-CN
|
||||
HZ-GB-2312=zh-CN
|
||||
IBM866=x-cyrillic
|
||||
ISO-2022-JP=ja
|
||||
ISO-8859-3=x-western
|
||||
ISO-8859-4=x-baltic
|
||||
ISO-8859-5=x-cyrillic
|
||||
ISO-8859-6=ar
|
||||
ISO-8859-7=el
|
||||
ISO-8859-8=he
|
||||
ISO-8859-8-I=he
|
||||
ISO-8859-10=x-western
|
||||
ISO-8859-13=x-baltic
|
||||
ISO-8859-14=x-western
|
||||
ISO-8859-15=x-western
|
||||
ISO-8859-16=x-central-euro
|
||||
ISO-8859-2=x-central-euro
|
||||
KOI8-R=x-cyrillic
|
||||
KOI8-U=x-cyrillic
|
||||
Shift_JIS=ja
|
||||
windows-1250=x-central-euro
|
||||
windows-1251=x-cyrillic
|
||||
windows-1252=x-western
|
||||
windows-1253=el
|
||||
windows-1254=tr
|
||||
windows-1255=he
|
||||
windows-1256=ar
|
||||
windows-1257=x-baltic
|
||||
windows-1258=x-western
|
||||
windows-874=th
|
||||
x-mac-cyrillic=x-cyrillic
|
||||
|
@ -29,6 +29,7 @@ LOCAL_INCLUDES += [
|
||||
|
||||
GENERATED_FILES += [
|
||||
'domainsfallbacks.properties.h',
|
||||
'encodingsgroups.properties.h',
|
||||
'labelsencodings.properties.h',
|
||||
'localesfallbacks.properties.h',
|
||||
'nonparticipatingdomains.properties.h',
|
||||
|
@ -1,104 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
## Rule of this file:
|
||||
## 1. key should always be in lower case ascii so we can do case insensitive
|
||||
## comparison in the code faster.
|
||||
|
||||
## Format of this file:
|
||||
## charset_name.title = a_title - specifies the human readable title for
|
||||
## this charset
|
||||
|
||||
us-ascii.title = English (US-ASCII)
|
||||
iso-8859-1.title = Western (ISO-8859-1)
|
||||
iso-8859-2.title = Central European (ISO-8859-2)
|
||||
iso-8859-3.title = South European (ISO-8859-3)
|
||||
iso-8859-4.title = Baltic (ISO-8859-4)
|
||||
iso-8859-9.title = Turkish (ISO-8859-9)
|
||||
iso-8859-10.title = Nordic (ISO-8859-10)
|
||||
iso-8859-13.title = Baltic (ISO-8859-13)
|
||||
iso-8859-14.title = Celtic (ISO-8859-14)
|
||||
iso-8859-15.title = Western (ISO-8859-15)
|
||||
iso-8859-16.title = Romanian (ISO-8859-16)
|
||||
windows-1250.title = Central European (Windows-1250)
|
||||
windows-1252.title = Western (Windows-1252)
|
||||
windows-1254.title = Turkish (Windows-1254)
|
||||
windows-1257.title = Baltic (Windows-1257)
|
||||
macintosh.title = Western (MacRoman)
|
||||
x-mac-ce.title = Central European (MacCE)
|
||||
x-mac-turkish.title = Turkish (MacTurkish)
|
||||
x-mac-croatian.title = Croatian (MacCroatian)
|
||||
x-mac-romanian.title = Romanian (MacRomanian)
|
||||
x-mac-icelandic.title = Icelandic (MacIcelandic)
|
||||
iso-2022-jp.title = Japanese (ISO-2022-JP)
|
||||
shift_jis.title = Japanese (Shift_JIS)
|
||||
euc-jp.title = Japanese (EUC-JP)
|
||||
big5.title = Chinese Traditional (Big5)
|
||||
big5-hkscs.title = Chinese Traditional (Big5-HKSCS)
|
||||
x-euc-tw.title = Chinese Traditional (EUC-TW)
|
||||
gb2312.title = Chinese Simplified (GB2312)
|
||||
hz-gb-2312.title = Chinese Simplified (HZ)
|
||||
gbk.title = Chinese Simplified (GBK)
|
||||
iso-2022-cn.title = Chinese Simplified (ISO-2022-CN)
|
||||
euc-kr.title = Korean (EUC-KR)
|
||||
x-johab.title = Korean (JOHAB)
|
||||
iso-2022-kr.title = Korean (ISO-2022-KR)
|
||||
utf-7.title = Unicode (UTF-7)
|
||||
utf-8.title = Unicode (UTF-8)
|
||||
utf-16.title = Unicode (UTF-16)
|
||||
utf-16le.title = Unicode (UTF-16LE)
|
||||
utf-16be.title = Unicode (UTF-16BE)
|
||||
iso-8859-5.title = Cyrillic (ISO-8859-5)
|
||||
iso-ir-111.title = Cyrillic (ISO-IR-111)
|
||||
windows-1251.title = Cyrillic (Windows-1251)
|
||||
x-mac-cyrillic.title = Cyrillic (MacCyrillic)
|
||||
x-mac-ukrainian.title = Cyrillic/Ukrainian (MacUkrainian)
|
||||
koi8-r.title = Cyrillic (KOI8-R)
|
||||
koi8-u.title = Cyrillic/Ukrainian (KOI8-U)
|
||||
iso-8859-7.title = Greek (ISO-8859-7)
|
||||
windows-1253.title = Greek (Windows-1253)
|
||||
x-mac-greek.title = Greek (MacGreek)
|
||||
windows-1258.title = Vietnamese (Windows-1258)
|
||||
x-viet-tcvn5712.title = Vietnamese (TCVN)
|
||||
viscii.title = Vietnamese (VISCII)
|
||||
x-viet-vps.title = Vietnamese (VPS)
|
||||
tis-620.title = Thai (TIS-620)
|
||||
iso-8859-11.title = Thai (ISO-8859-11)
|
||||
windows-874.title = Thai (Windows-874)
|
||||
ibm874.title = Thai (IBM-874)
|
||||
armscii-8.title = Armenian (ARMSCII-8)
|
||||
iso-8859-6.title = Arabic (ISO-8859-6)
|
||||
iso-8859-6-i.title = Arabic (ISO-8859-6-I)
|
||||
iso-8859-6-e.title = Arabic (ISO-8859-6-E)
|
||||
iso-8859-8.title = Hebrew Visual (ISO-8859-8)
|
||||
iso-8859-8-i.title = Hebrew (ISO-8859-8-I)
|
||||
iso-8859-8-e.title = Hebrew (ISO-8859-8-E)
|
||||
windows-1255.title = Hebrew (Windows-1255)
|
||||
windows-1256.title = Arabic (Windows-1256)
|
||||
x-user-defined.title = User Defined
|
||||
ibm866.title = Cyrillic/Russian (CP-866)
|
||||
ibm850.title = Western (IBM-850)
|
||||
ibm852.title = Central European (IBM-852)
|
||||
ibm855.title = Cyrillic (IBM-855)
|
||||
ibm857.title = Turkish (IBM-857)
|
||||
ibm862.title = Hebrew (IBM-862)
|
||||
gb18030.title = Chinese Simplified (GB18030)
|
||||
x-mac-arabic.title = Arabic (MacArabic)
|
||||
x-mac-farsi.title = Farsi (MacFarsi)
|
||||
x-mac-hebrew.title = Hebrew (MacHebrew)
|
||||
x-mac-devanagari.title = Hindi (MacDevanagari)
|
||||
x-mac-gujarati.title = Gujarati (MacGujarati)
|
||||
x-mac-gurmukhi.title = Gurmukhi (MacGurmukhi)
|
||||
|
||||
|
||||
chardet.off.title = (Off)
|
||||
chardet.universal_charset_detector.title = Universal
|
||||
chardet.ja_parallel_state_machine.title = Japanese
|
||||
chardet.ko_parallel_state_machine.title = Korean
|
||||
chardet.zhtw_parallel_state_machine.title = Traditional Chinese
|
||||
chardet.zhcn_parallel_state_machine.title = Simplified Chinese
|
||||
chardet.zh_parallel_state_machine.title = Chinese
|
||||
chardet.cjk_parallel_state_machine.title = East Asian
|
||||
chardet.ruprob.title = Russian
|
||||
chardet.ukprob.title = Ukrainian
|
@ -14,7 +14,6 @@
|
||||
locale/@AB_CD@/global/netErrorApp.dtd (%chrome/netErrorApp.dtd)
|
||||
locale/@AB_CD@/global/global.dtd (%chrome/global.dtd)
|
||||
locale/@AB_CD@/global/appstrings.properties (%chrome/appstrings.properties)
|
||||
locale/@AB_CD@/global/charsetTitles.properties (%chrome/charsetTitles.properties)
|
||||
locale/@AB_CD@/global/global-strres.properties (%chrome/global-strres.properties)
|
||||
locale/@AB_CD@/global/plugins.properties (%chrome/plugins.properties)
|
||||
locale/@AB_CD@/global/nsWebBrowserPersist.properties (%chrome/nsWebBrowserPersist.properties)
|
||||
|
@ -265,6 +265,24 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MozMobileConnection by ServiceId
|
||||
*
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: the one indicated in
|
||||
* start*TestCommon() or 0 if not indicated.
|
||||
*
|
||||
* @return A MozMobileConnection.
|
||||
*/
|
||||
function getMozMobileConnectionByServiceId(aServiceId) {
|
||||
let mobileConn = mobileConnection;
|
||||
if (aServiceId !== undefined) {
|
||||
mobileConn =
|
||||
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
}
|
||||
return mobileConn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for one named MobileConnection event.
|
||||
*
|
||||
@ -283,11 +301,7 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
|
||||
function waitForManagerEvent(aEventName, aServiceId) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let mobileConn = mobileConnection;
|
||||
if (aServiceId !== undefined) {
|
||||
mobileConn =
|
||||
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
}
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
|
||||
mobileConn.addEventListener(aEventName, function onevent(aEvent) {
|
||||
mobileConn.removeEventListener(aEventName, onevent);
|
||||
@ -426,11 +440,7 @@ function setDataEnabledAndWait(aEnabled, aServiceId) {
|
||||
promises.push(waitForManagerEvent("datachange", aServiceId));
|
||||
promises.push(setDataEnabled(aEnabled));
|
||||
Promise.all(promises).then(function keepWaiting() {
|
||||
let mobileConn = mobileConnection;
|
||||
if (aServiceId !== undefined) {
|
||||
mobileConn =
|
||||
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
}
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
// To ignore some transient states, we only resolve that deferred promise
|
||||
// when the |connected| state equals to the expected one and never rejects.
|
||||
let connected = mobileConn.data.connected;
|
||||
@ -445,6 +455,114 @@ function setDataEnabledAndWait(aEnabled, aServiceId) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set radio enabling state.
|
||||
*
|
||||
* Resolve no matter the request succeeds or fails. Never reject.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
* A boolean state.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: the one indicated in
|
||||
* start*TestCommon() or 0 if not indicated.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setRadioEnabled(aEnabled, aServiceId) {
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
let request = mobileConn.setRadioEnabled(aEnabled);
|
||||
return wrapDomRequestAsPromise(request)
|
||||
.then(function onsuccess() {
|
||||
ok(true, "setRadioEnabled " + aEnabled + " on " + aServiceId + " success.");
|
||||
}, function onerror() {
|
||||
ok(false, "setRadioEnabled " + aEnabled + " on " + aServiceId + " " +
|
||||
request.error.name);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set radio enabling state and wait for "radiostatechange" event.
|
||||
*
|
||||
* Resolve if radio state changed to the expected one. Never reject.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
* A boolean state.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: the one indicated in
|
||||
* start*TestCommon() or 0 if not indicated.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setRadioEnabledAndWait(aEnabled, aServiceId) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("radiostatechange", aServiceId));
|
||||
promises.push(setRadioEnabled(aEnabled, aServiceId));
|
||||
Promise.all(promises).then(function keepWaiting() {
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
// To ignore some transient states, we only resolve that deferred promise
|
||||
// when |radioState| equals to the expected one and never rejects.
|
||||
let state = mobileConn.radioState;
|
||||
aEnabled = aEnabled ? "enabled" : "disabled";
|
||||
if (state == aEnabled) {
|
||||
deferred.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
return waitForManagerEvent("radiostatechange", aServiceId).then(keepWaiting);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set CLIR (calling line id restriction).
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params:
|
||||
* 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
|
||||
*
|
||||
* @param aMode
|
||||
* A short number.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: the one indicated in
|
||||
* start*TestCommon() or 0 if not indicated.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setClir(aMode, aServiceId) {
|
||||
ok(true, "setClir(" + aMode + ", " + aServiceId + ")");
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
let request = mobileConn.setCallingLineIdRestriction(aMode);
|
||||
return wrapDomRequestAsPromise(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CLIR (calling line id restriction).
|
||||
*
|
||||
* Fulfill params:
|
||||
* CLIR mode.
|
||||
* Reject params:
|
||||
* 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
|
||||
*
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: the one indicated in
|
||||
* start*TestCommon() or 0 if not indicated.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getClir(aServiceId) {
|
||||
ok(true, "getClir(" + aServiceId + ")");
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
let request = mobileConn.getCallingLineIdRestriction();
|
||||
return wrapDomRequestAsPromise(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set voice/data state and wait for state change.
|
||||
*
|
||||
@ -487,11 +605,7 @@ function setEmulatorRoamingAndWait(aRoaming, aServiceId) {
|
||||
let state = (aRoaming ? "roaming" : "home");
|
||||
return setEmulatorVoiceDataStateAndWait(aWhich, state, aServiceId)
|
||||
.then(() => {
|
||||
let mobileConn = mobileConnection;
|
||||
if (aServiceId !== undefined) {
|
||||
mobileConn =
|
||||
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
}
|
||||
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
|
||||
is(mobileConn[aWhich].roaming, aRoaming,
|
||||
aWhich + ".roaming")
|
||||
});
|
||||
|
@ -27,3 +27,4 @@ qemu = true
|
||||
[test_mobile_data_ipv6.js]
|
||||
disabled = Bug 979137
|
||||
[test_dsds_mobile_data_connection.js]
|
||||
[test_mobile_clir_radio_off.js]
|
||||
|
@ -0,0 +1,36 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function testSetClirOnRadioOff(aMode) {
|
||||
log("testSetClirOnRadioOff (set to mode: " + aMode + ")");
|
||||
return Promise.resolve()
|
||||
.then(() => setClir(aMode))
|
||||
.then(() => {
|
||||
ok(false, "shouldn't resolve");
|
||||
}, (evt) => {
|
||||
is(evt.target.error.name, "RadioNotAvailable");
|
||||
});
|
||||
}
|
||||
|
||||
function testGetClirOnRadioOff() {
|
||||
log("testGetClirOnRadioOff");
|
||||
return Promise.resolve()
|
||||
.then(() => getClir())
|
||||
.then(() => {
|
||||
ok(false, "shouldn't resolve");
|
||||
}, (evt) => {
|
||||
is(evt.target.error.name, "RadioNotAvailable");
|
||||
});
|
||||
}
|
||||
|
||||
startTestCommon(function() {
|
||||
return setRadioEnabledAndWait(false)
|
||||
.then(() => testSetClirOnRadioOff(0))
|
||||
.then(() => testGetClirOnRadioOff())
|
||||
// Restore radio state.
|
||||
.then(() => setRadioEnabledAndWait(true),
|
||||
() => setRadioEnabledAnWait(true));
|
||||
});
|
@ -189,6 +189,9 @@ function getRadioDisabledState() {
|
||||
function MmsConnection(aServiceId) {
|
||||
this.serviceId = aServiceId;
|
||||
this.radioInterface = gRil.getRadioInterface(aServiceId);
|
||||
this.pendingCallbacks = [];
|
||||
this.connectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this.disconnectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
};
|
||||
|
||||
MmsConnection.prototype = {
|
||||
@ -232,14 +235,14 @@ MmsConnection.prototype = {
|
||||
//A queue to buffer the MMS HTTP requests when the MMS network
|
||||
//is not yet connected. The buffered requests will be cleared
|
||||
//if the MMS network fails to be connected within a timer.
|
||||
pendingCallbacks: [],
|
||||
pendingCallbacks: null,
|
||||
|
||||
/** MMS network connection reference count. */
|
||||
refCount: 0,
|
||||
|
||||
connectTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
|
||||
connectTimer: null,
|
||||
|
||||
disconnectTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
|
||||
disconnectTimer: null,
|
||||
|
||||
/**
|
||||
* Callback when |connectTimer| is timeout or cancelled by shutdown.
|
||||
@ -1324,6 +1327,9 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
|
||||
}
|
||||
|
||||
let response = MMS.PduHelper.parse(data, null);
|
||||
if (DEBUG) {
|
||||
debug("Parsed M-Send.conf: " + JSON.stringify(response));
|
||||
}
|
||||
if (!response || (response.type != MMS.MMS_PDU_TYPE_SEND_CONF)) {
|
||||
callback(MMS.MMS_PDU_RESPONSE_ERROR_UNSUPPORTED_MESSAGE, null);
|
||||
return;
|
||||
|
@ -11,8 +11,11 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
|
||||
var RIL = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", RIL);
|
||||
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
const RIL_GETMESSAGESCURSOR_CID =
|
||||
Components.ID("{484d1ad8-840e-4782-9dc4-9ebc4d914937}");
|
||||
|
@ -6,6 +6,4 @@ qemu=true
|
||||
[test_ndef.js]
|
||||
[test_nfc_enabled.js]
|
||||
[test_nfc_manager_tech_discovered.js]
|
||||
disabled = Bug 996426
|
||||
[test_nfc_peer.js]
|
||||
disabled = Bug 996426
|
||||
|
@ -8,9 +8,13 @@
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["PhoneNumber"];
|
||||
|
||||
Components.utils.import("resource://gre/modules/PhoneNumberMetaData.jsm");
|
||||
Components.utils.import("resource://gre/modules/PhoneNumberNormalizer.jsm");
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PHONE_NUMBER_META_DATA",
|
||||
"resource://gre/modules/PhoneNumberMetaData.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberNormalizer",
|
||||
"resource://gre/modules/PhoneNumberNormalizer.jsm");
|
||||
this.PhoneNumber = (function (dataBase) {
|
||||
// Use strict in our context only - users might not want it
|
||||
'use strict';
|
||||
|
@ -14,8 +14,10 @@ const Ci = Components.interfaces;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import("resource://gre/modules/PhoneNumberNormalizer.jsm");
|
||||
Cu.import("resource://gre/modules/mcc_iso3166_table.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberNormalizer",
|
||||
"resource://gre/modules/PhoneNumberNormalizer.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MCC_ISO3166_TABLE",
|
||||
"resource://gre/modules/mcc_iso3166_table.jsm");
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "mobileConnection",
|
||||
@ -196,7 +198,8 @@ this.PhoneNumberUtils = {
|
||||
let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
if (inParent) {
|
||||
Cu.import("resource://gre/modules/PhoneNumber.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumber",
|
||||
"resource://gre/modules/PhoneNumber.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
@ -8,18 +8,18 @@
|
||||
#include "prlink.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsPluginsDir.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsIBlocklistService.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsPluginLogging.h"
|
||||
#include "nsNPAPIPlugin.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include <cctype>
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using namespace mozilla;
|
||||
|
||||
// These legacy flags are used in the plugin registry. The states are now
|
||||
@ -236,17 +236,12 @@ nsresult nsPluginTag::EnsureMembersAreUTF8()
|
||||
do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
nsAutoCString charset;
|
||||
rv = pcs->GetCharset(kPlatformCharsetSel_FileName, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!charset.LowerCaseEqualsLiteral("utf-8")) {
|
||||
rv = ccm->GetUnicodeDecoderRaw(charset.get(), getter_AddRefs(decoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
decoder = EncodingUtils::DecoderForEncoding(charset);
|
||||
ConvertToUTF8(decoder, mFileName);
|
||||
ConvertToUTF8(decoder, mFullPath);
|
||||
}
|
||||
@ -257,9 +252,7 @@ nsresult nsPluginTag::EnsureMembersAreUTF8()
|
||||
rv = pcs->GetCharset(kPlatformCharsetSel_PlainTextInFile, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!charset.LowerCaseEqualsLiteral("utf-8")) {
|
||||
rv = ccm->GetUnicodeDecoderRaw(charset.get(), getter_AddRefs(decoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
decoder = EncodingUtils::DecoderForEncoding(charset);
|
||||
ConvertToUTF8(decoder, mName);
|
||||
ConvertToUTF8(decoder, mDescription);
|
||||
for (uint32_t i = 0; i < mMimeDescriptions.Length(); ++i) {
|
||||
|
@ -22,8 +22,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let NFC = {};
|
||||
Cu.import("resource://gre/modules/nfc_consts.js", NFC);
|
||||
XPCOMUtils.defineLazyGetter(this, "NFC", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/nfc_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";
|
||||
|
@ -23,8 +23,11 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
let NFC = {};
|
||||
Cu.import("resource://gre/modules/nfc_consts.js", NFC);
|
||||
XPCOMUtils.defineLazyGetter(this, "NFC", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/nfc_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";
|
||||
|
@ -21,8 +21,11 @@ Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var RIL = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", RIL);
|
||||
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
|
||||
|
||||
@ -1378,6 +1381,13 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
let radioState = this.rilContexts[clientId].radioState;
|
||||
if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
|
||||
this.dispatchFireRequestError(requestId,
|
||||
RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCallingLineIdRestriction", {
|
||||
clientId: clientId,
|
||||
data: {
|
||||
@ -1389,7 +1399,6 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
setCallingLineIdRestriction: function(clientId, window, clirMode) {
|
||||
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1397,6 +1406,13 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
let radioState = this.rilContexts[clientId].radioState;
|
||||
if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
|
||||
this.dispatchFireRequestError(requestId,
|
||||
RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
|
||||
clientId: clientId,
|
||||
data: {
|
||||
|
@ -24,8 +24,11 @@ Cu.import("resource://gre/modules/systemlibs.js");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
var RIL = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", RIL);
|
||||
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
// set to true in ril_consts.js to see debug messages
|
||||
var DEBUG = RIL.DEBUG_RIL;
|
||||
@ -96,7 +99,6 @@ const kSettingsTimezoneAutoUpdateAvailable = "time.timezone.automatic-update.ava
|
||||
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
|
||||
|
||||
const kPrefCellBroadcastDisabled = "ril.cellbroadcast.disabled";
|
||||
const kPrefClirModePreference = "ril.clirMode";
|
||||
const kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
|
||||
|
||||
const DOM_MOBILE_MESSAGE_DELIVERY_RECEIVED = "received";
|
||||
@ -1623,7 +1625,6 @@ WorkerMessenger.prototype = {
|
||||
let options = {
|
||||
debug: DEBUG,
|
||||
cellBroadcastDisabled: false,
|
||||
clirMode: RIL.CLIR_DEFAULT,
|
||||
quirks: {
|
||||
callstateExtraUint32:
|
||||
libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true",
|
||||
@ -1651,10 +1652,6 @@ WorkerMessenger.prototype = {
|
||||
Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
|
||||
} catch(e) {}
|
||||
|
||||
this.send(null, "setInitialOptions", options);
|
||||
},
|
||||
|
||||
@ -3502,16 +3499,6 @@ RadioInterface.prototype = {
|
||||
this.clientId, message);
|
||||
},
|
||||
|
||||
_updateCallingLineIdRestrictionPref: function(mode) {
|
||||
try {
|
||||
Services.prefs.setIntPref(kPrefClirModePreference, mode);
|
||||
Services.prefs.savePrefFile(null);
|
||||
if (DEBUG) {
|
||||
this.debug(kPrefClirModePreference + " pref is now " + mode);
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
sendMMI: function(target, message) {
|
||||
if (DEBUG) this.debug("SendMMI " + JSON.stringify(message));
|
||||
this.workerMessenger.send("sendMMI", message, (function(response) {
|
||||
@ -3519,7 +3506,6 @@ RadioInterface.prototype = {
|
||||
this._sendCfStateChanged(response);
|
||||
} else if (response.isSetCLIR && response.success) {
|
||||
this._sendClirModeChanged(response.clirMode);
|
||||
this._updateCallingLineIdRestrictionPref(response.clirMode);
|
||||
}
|
||||
|
||||
target.sendAsyncMessage("RIL:SendMMI", {
|
||||
@ -3550,7 +3536,6 @@ RadioInterface.prototype = {
|
||||
this.workerMessenger.send("setCLIR", message, (function(response) {
|
||||
if (response.success) {
|
||||
this._sendClirModeChanged(response.clirMode);
|
||||
this._updateCallingLineIdRestrictionPref(response.clirMode);
|
||||
}
|
||||
target.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
|
||||
clientId: this.clientId,
|
||||
|
@ -53,7 +53,6 @@ if (!this.debug) {
|
||||
}
|
||||
|
||||
let RIL_CELLBROADCAST_DISABLED;
|
||||
let RIL_CLIR_MODE;
|
||||
let RIL_EMERGENCY_NUMBERS;
|
||||
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
|
||||
|
||||
@ -226,7 +225,6 @@ function RilObject(aContext) {
|
||||
// Init properties that are only initialized once.
|
||||
this.v5Legacy = RILQUIRKS_V5_LEGACY;
|
||||
this.cellBroadcastDisabled = RIL_CELLBROADCAST_DISABLED;
|
||||
this.clirMode = RIL_CLIR_MODE;
|
||||
|
||||
this._hasHangUpPendingOutgoingCall = false;
|
||||
}
|
||||
@ -271,11 +269,6 @@ RilObject.prototype = {
|
||||
*/
|
||||
cellBroadcastDisabled: false,
|
||||
|
||||
/**
|
||||
* Global CLIR mode settings.
|
||||
*/
|
||||
clirMode: CLIR_DEFAULT,
|
||||
|
||||
/**
|
||||
* Parsed Cell Broadcast search lists.
|
||||
* cellBroadcastConfigs.MMI should be preserved over rild reset.
|
||||
@ -1121,13 +1114,10 @@ RilObject.prototype = {
|
||||
* nsIDOMMozMobileConnection interface.
|
||||
*/
|
||||
setCLIR: function(options) {
|
||||
if (options) {
|
||||
this.clirMode = options.clirMode;
|
||||
}
|
||||
let Buf = this.context.Buf;
|
||||
Buf.newParcel(REQUEST_SET_CLIR, options);
|
||||
Buf.writeInt32(1);
|
||||
Buf.writeInt32(this.clirMode);
|
||||
Buf.writeInt32(options.clirMode);
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
@ -6489,7 +6479,6 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
|
||||
this.getBasebandVersion();
|
||||
this.updateCellBroadcastConfig();
|
||||
this.setPreferredNetworkType();
|
||||
this.setCLIR();
|
||||
if ((RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
|
||||
RILQUIRKS_SUBSCRIPTION_CONTROL) &&
|
||||
this._attachDataRegistration) {
|
||||
@ -14747,7 +14736,6 @@ let ContextPool = {
|
||||
DEBUG = DEBUG_WORKER || aOptions.debug;
|
||||
RIL_EMERGENCY_NUMBERS = aOptions.rilEmergencyNumbers;
|
||||
RIL_CELLBROADCAST_DISABLED = aOptions.cellBroadcastDisabled;
|
||||
RIL_CLIR_MODE = aOptions.clirMode;
|
||||
|
||||
let quirks = aOptions.quirks;
|
||||
RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32;
|
||||
|
@ -11,8 +11,11 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
var RIL = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", RIL);
|
||||
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
|
||||
let obj = {};
|
||||
Cu.import("resource://gre/modules/ril_consts.js", obj);
|
||||
return obj;
|
||||
});
|
||||
|
||||
const GONK_TELEPHONYPROVIDER_CONTRACTID =
|
||||
"@mozilla.org/telephony/gonktelephonyprovider;1";
|
||||
|
@ -10,6 +10,7 @@ enum WifiWPSMethod {
|
||||
|
||||
enum ConnectionStatus {
|
||||
"connecting",
|
||||
"authenticating",
|
||||
"associated",
|
||||
"connected",
|
||||
"disconnected",
|
||||
@ -53,6 +54,7 @@ dictionary NetworkProperties {
|
||||
DOMString eap;
|
||||
DOMString pin;
|
||||
boolean dontConnect;
|
||||
DOMString serverCertificate;
|
||||
};
|
||||
|
||||
[Constructor(optional NetworkProperties properties),
|
||||
@ -87,6 +89,7 @@ interface MozWifiNetwork {
|
||||
attribute DOMString? eap;
|
||||
attribute DOMString? pin;
|
||||
attribute boolean? dontConnect;
|
||||
attribute DOMString? serverCertificate;
|
||||
};
|
||||
|
||||
[JSImplementation="@mozilla.org/mozwificonnection;1",
|
||||
|
@ -102,6 +102,7 @@ DOMWifiManager.prototype = {
|
||||
"WifiManager:onconnect", "WifiManager:ondisconnect",
|
||||
"WifiManager:onwpstimeout", "WifiManager:onwpsfail",
|
||||
"WifiManager:onwpsoverlap", "WifiManager:connectionInfoUpdate",
|
||||
"WifiManager:onauthenticating",
|
||||
"WifiManager:onconnectingfailed"];
|
||||
this.initDOMRequestHelper(aWindow, messages);
|
||||
this._mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
|
||||
@ -365,6 +366,11 @@ DOMWifiManager.prototype = {
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
break;
|
||||
case "WifiManager:onauthenticating":
|
||||
this._currentNetwork = msg.network;
|
||||
this._connectionStatus = "authenticating";
|
||||
this._fireStatusChangeEvent();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -672,6 +672,27 @@ var WifiManager = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
function handleWpaEapEvents(event) {
|
||||
if (event.indexOf("CTRL-EVENT-EAP-FAILURE") !== -1) {
|
||||
if (event.indexOf("EAP authentication failed") !== -1) {
|
||||
notify("passwordmaybeincorrect");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (event.indexOf("CTRL-EVENT-EAP-TLS-CERT-ERROR") !== -1) {
|
||||
// Cert Error
|
||||
manager.disconnect(function() {
|
||||
manager.reassociate(function(){});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (event.indexOf("CTRL-EVENT-EAP-STARTED") !== -1) {
|
||||
notifyStateChange({ state: "AUTHENTICATING" });
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle events sent to us by the event worker.
|
||||
function handleEvent(event) {
|
||||
debug("Event coming in: " + event);
|
||||
@ -777,12 +798,6 @@ var WifiManager = (function() {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (eventData.indexOf("CTRL-EVENT-EAP-FAILURE") === 0) {
|
||||
if (event.indexOf("EAP authentication failed") !== -1) {
|
||||
notify("passwordmaybeincorrect");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (eventData.indexOf("CTRL-EVENT-CONNECTED") === 0) {
|
||||
// Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]
|
||||
var bssid = event.split(" ")[4];
|
||||
@ -804,6 +819,9 @@ var WifiManager = (function() {
|
||||
notify("scanresultsavailable");
|
||||
return true;
|
||||
}
|
||||
if (eventData.indexOf("CTRL-EVENT-EAP") === 0) {
|
||||
return handleWpaEapEvents(event);
|
||||
}
|
||||
if (eventData.indexOf("WPS-TIMEOUT") === 0) {
|
||||
notifyStateChange({ state: "WPS_TIMEOUT", BSSID: null, id: -1 });
|
||||
return true;
|
||||
@ -1061,7 +1079,7 @@ var WifiManager = (function() {
|
||||
"ssid", "bssid", "psk", "wep_key0", "wep_key1", "wep_key2", "wep_key3",
|
||||
"wep_tx_keyidx", "priority", "key_mgmt", "scan_ssid", "disabled",
|
||||
"identity", "password", "auth_alg", "phase1", "phase2", "eap", "pin",
|
||||
"pcsc"
|
||||
"pcsc", "ca_cert"
|
||||
];
|
||||
|
||||
manager.getNetworkConfiguration = function(config, callback) {
|
||||
@ -1081,16 +1099,17 @@ var WifiManager = (function() {
|
||||
var netId = config.netId;
|
||||
var done = 0;
|
||||
var errors = 0;
|
||||
|
||||
function hasValidProperty(name) {
|
||||
return ((name in config) &&
|
||||
config[name] != null &&
|
||||
(["password", "wep_key0", "psk"].indexOf(name) !== -1 ||
|
||||
config[name] !== '*'));
|
||||
}
|
||||
|
||||
for (var n = 0; n < networkConfigurationFields.length; ++n) {
|
||||
let fieldName = networkConfigurationFields[n];
|
||||
if (!(fieldName in config) ||
|
||||
// These fields are special: We can't retrieve them from the
|
||||
// supplicant, and often we have a star in our config. In that case,
|
||||
// we need to avoid overwriting the correct password with a *.
|
||||
(fieldName === "password" ||
|
||||
fieldName === "wep_key0" ||
|
||||
fieldName === "psk") &&
|
||||
config[fieldName] === '*') {
|
||||
if (!hasValidProperty(fieldName)) {
|
||||
++done;
|
||||
} else {
|
||||
wifiCommand.setNetworkVariable(netId, fieldName, config[fieldName], function(ok) {
|
||||
@ -1532,7 +1551,8 @@ Network.api = {
|
||||
eap: "rw",
|
||||
pin: "rw",
|
||||
phase1: "rw",
|
||||
phase2: "rw"
|
||||
phase2: "rw",
|
||||
serverCertificate: "rw"
|
||||
};
|
||||
|
||||
// Note: We never use ScanResult.prototype, so the fact that it's unrelated to
|
||||
@ -1763,6 +1783,10 @@ function WifiWorker() {
|
||||
pub.known = true;
|
||||
if (net.scan_ssid === 1)
|
||||
pub.hidden = true;
|
||||
if ("ca_cert" in net && net.ca_cert &&
|
||||
net.ca_cert.indexOf("keystore://WIFI_SERVERCERT_" === 0)) {
|
||||
pub.serverCertificate = net.ca_cert.substr(27);
|
||||
}
|
||||
return pub;
|
||||
};
|
||||
|
||||
@ -1825,15 +1849,29 @@ function WifiWorker() {
|
||||
configured.auth_alg = net.auth_alg = "OPEN SHARED";
|
||||
}
|
||||
|
||||
if ("pin" in net) {
|
||||
net.pin = quote(net.pin);
|
||||
function hasValidProperty(name) {
|
||||
return ((name in net) && net[name] != null);
|
||||
}
|
||||
|
||||
if ("phase1" in net)
|
||||
net.phase1 = quote(net.phase1);
|
||||
if (hasValidProperty("eap")) {
|
||||
if (hasValidProperty("pin")) {
|
||||
net.pin = quote(net.pin);
|
||||
}
|
||||
|
||||
if ("phase2" in net)
|
||||
net.phase2 = quote(net.phase2);
|
||||
if (hasValidProperty("phase1"))
|
||||
net.phase1 = quote(net.phase1);
|
||||
|
||||
if (hasValidProperty("phase2")) {
|
||||
if (net.eap === "PEAP") {
|
||||
net.phase2 = quote("auth=" + net.phase2);
|
||||
} else { // TLS, TTLS
|
||||
net.phase2 = quote("autheap=" + net.phase2);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasValidProperty("serverCertificate"))
|
||||
net.ca_cert = quote("keystore://WIFI_SERVERCERT_" + net.serverCertificate);
|
||||
}
|
||||
|
||||
return net;
|
||||
};
|
||||
@ -2057,6 +2095,9 @@ function WifiWorker() {
|
||||
case "WPS_OVERLAP_DETECTED":
|
||||
self._fireEvent("onwpsoverlap", {});
|
||||
break;
|
||||
case "AUTHENTICATING":
|
||||
self._fireEvent("onauthenticating", {network: netToDOM(self.currentNetwork)});
|
||||
break;
|
||||
case "SCANNING":
|
||||
// If we're already scanning in the background, we don't need to worry
|
||||
// about getting stuck while scanning.
|
||||
|
@ -83,13 +83,12 @@ struct unicode_info {
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
using mozilla::dom::EncodingUtils;
|
||||
#endif
|
||||
|
||||
struct unicode_info2 {
|
||||
@ -5536,22 +5535,17 @@ struct cs_info * get_current_cs(const char * es) {
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv))
|
||||
nsAutoCString label(es);
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return ccs;
|
||||
}
|
||||
encoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
decoder = EncodingUtils::DecoderForEncoding(encoding);
|
||||
encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
|
@ -67,7 +67,6 @@
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "mozISpellI18NManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
@ -76,6 +75,9 @@
|
||||
#include <stdlib.h>
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID);
|
||||
|
||||
@ -205,18 +207,13 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary)
|
||||
if (!mHunspell)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = ccm->GetUnicodeDecoder(mHunspell->get_dic_encoding(),
|
||||
getter_AddRefs(mDecoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = ccm->GetUnicodeEncoder(mHunspell->get_dic_encoding(),
|
||||
getter_AddRefs(mEncoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsDependentCString label(mHunspell->get_dic_encoding());
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
mEncoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(encoding);
|
||||
|
||||
if (mEncoder)
|
||||
mEncoder->SetOutputErrorBehavior(mEncoder->kOnError_Signal, nullptr, '?');
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
@ -144,6 +144,11 @@ DrawSurfaceWithTextureCoords(DrawTarget *aDest,
|
||||
aTextureCoords.y * aSource->GetSize().height,
|
||||
aTextureCoords.width * aSource->GetSize().width,
|
||||
aTextureCoords.height * aSource->GetSize().height);
|
||||
|
||||
// Floating point error can accumulate above and we know our visible region
|
||||
// is integer-aligned, so round it out.
|
||||
sourceRect.Round();
|
||||
|
||||
// Compute a transform that maps sourceRect to aDestRect.
|
||||
gfxMatrix transform =
|
||||
gfxUtils::TransformRectToRect(sourceRect,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "imgIContainer.h"
|
||||
#include "imgStatusTracker.h"
|
||||
#include "ImageURL.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
class nsIRequest;
|
||||
class nsIInputStream;
|
||||
@ -84,6 +85,13 @@ public:
|
||||
virtual size_t NonHeapSizeOfDecoded() const = 0;
|
||||
virtual size_t OutOfProcessSizeOfDecoded() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the size of the memory taken up for the parsed vector image's
|
||||
* document (e.g. SVGDocument), and returns the document's URL via the
|
||||
* aDocURL outparam.
|
||||
*/
|
||||
virtual size_t HeapSizeOfVectorImageDocument(nsACString* aDocURL = nullptr) const = 0;
|
||||
|
||||
virtual void IncrementAnimationConsumers() = 0;
|
||||
virtual void DecrementAnimationConsumers() = 0;
|
||||
#ifdef DEBUG
|
||||
|
@ -35,6 +35,10 @@ public:
|
||||
virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE;
|
||||
virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE;
|
||||
|
||||
virtual size_t HeapSizeOfVectorImageDocument(nsACString* aDocURL = nullptr) const MOZ_OVERRIDE {
|
||||
return mInnerImage->HeapSizeOfVectorImageDocument(aDocURL);
|
||||
}
|
||||
|
||||
virtual void IncrementAnimationConsumers() MOZ_OVERRIDE;
|
||||
virtual void DecrementAnimationConsumers() MOZ_OVERRIDE;
|
||||
#ifdef DEBUG
|
||||
|
@ -181,6 +181,10 @@ public:
|
||||
virtual size_t NonHeapSizeOfDecoded() const;
|
||||
virtual size_t OutOfProcessSizeOfDecoded() const;
|
||||
|
||||
virtual size_t HeapSizeOfVectorImageDocument(nsACString* aDocURL = nullptr) const MOZ_OVERRIDE {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Triggers discarding. */
|
||||
void Discard(bool force = false);
|
||||
void ForceDiscard() { Discard(/* force = */ true); }
|
||||
|
@ -22,8 +22,10 @@
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStubDocumentObserver.h"
|
||||
#include "nsSVGEffects.h" // for nsSVGRenderingObserver
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "Orientation.h"
|
||||
#include "SVGDocumentWrapper.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
@ -359,28 +361,61 @@ VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocS
|
||||
// We're not storing the source data -- we just feed that directly to
|
||||
// our helper SVG document as we receive it, for it to parse.
|
||||
// So 0 is an appropriate return value here.
|
||||
// If implementing this, we'll need to restructure our callers to make sure
|
||||
// any amount we return is attributed to the vector images measure (i.e.
|
||||
// "explicit/images/{content,chrome}/vector/{used,unused}/...")
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
VectorImage::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
// XXXdholbert TODO: return num bytes used by helper SVG doc. (bug 590790)
|
||||
// If implementing this, we'll need to restructure our callers to make sure
|
||||
// any amount we return is attributed to the vector images measure (i.e.
|
||||
// "explicit/images/{content,chrome}/vector/{used,unused}/...")
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
VectorImage::NonHeapSizeOfDecoded() const
|
||||
{
|
||||
// If implementing this, we'll need to restructure our callers to make sure
|
||||
// any amount we return is attributed to the vector images measure (i.e.
|
||||
// "explicit/images/{content,chrome}/vector/{used,unused}/...")
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
VectorImage::OutOfProcessSizeOfDecoded() const
|
||||
{
|
||||
// If implementing this, we'll need to restructure our callers to make sure
|
||||
// any amount we return is attributed to the vector images measure (i.e.
|
||||
// "explicit/images/{content,chrome}/vector/{used,unused}/...")
|
||||
return 0;
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(WindowsMallocSizeOf);
|
||||
|
||||
size_t
|
||||
VectorImage::HeapSizeOfVectorImageDocument(nsACString* aDocURL) const
|
||||
{
|
||||
nsIDocument* doc = mSVGDocumentWrapper->GetDocument();
|
||||
if (!doc) {
|
||||
if (aDocURL) {
|
||||
mURI->GetSpec(*aDocURL);
|
||||
}
|
||||
return 0; // No document, so no memory used for the document
|
||||
}
|
||||
|
||||
if (aDocURL) {
|
||||
doc->GetDocumentURI()->GetSpec(*aDocURL);
|
||||
}
|
||||
|
||||
nsWindowSizes windowSizes(WindowsMallocSizeOf);
|
||||
doc->DocAddSizeOfExcludingThis(&windowSizes);
|
||||
return windowSizes.getTotalSize();
|
||||
}
|
||||
|
||||
nsresult
|
||||
VectorImage::OnImageDataComplete(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
virtual size_t NonHeapSizeOfDecoded() const;
|
||||
virtual size_t OutOfProcessSizeOfDecoded() const;
|
||||
|
||||
virtual size_t HeapSizeOfVectorImageDocument(nsACString* aDocURL = nullptr) const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream* aInStr,
|
||||
|
@ -75,56 +75,101 @@ public:
|
||||
NS_ENSURE_SUCCESS(rv, rv); \
|
||||
} while (0)
|
||||
|
||||
REPORT("explicit/images/chrome/used/raw",
|
||||
REPORT("explicit/images/chrome/raster/used/raw",
|
||||
KIND_HEAP, chrome.mUsedRaw,
|
||||
"Memory used by in-use chrome images (compressed data).");
|
||||
|
||||
REPORT("explicit/images/chrome/used/uncompressed-heap",
|
||||
REPORT("explicit/images/chrome/raster/used/uncompressed-heap",
|
||||
KIND_HEAP, chrome.mUsedUncompressedHeap,
|
||||
"Memory used by in-use chrome images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/chrome/used/uncompressed-nonheap",
|
||||
REPORT("explicit/images/chrome/raster/used/uncompressed-nonheap",
|
||||
KIND_NONHEAP, chrome.mUsedUncompressedNonheap,
|
||||
"Memory used by in-use chrome images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/chrome/unused/raw",
|
||||
REPORT("explicit/images/chrome/raster/unused/raw",
|
||||
KIND_HEAP, chrome.mUnusedRaw,
|
||||
"Memory used by not in-use chrome images (compressed data).");
|
||||
|
||||
REPORT("explicit/images/chrome/unused/uncompressed-heap",
|
||||
REPORT("explicit/images/chrome/raster/unused/uncompressed-heap",
|
||||
KIND_HEAP, chrome.mUnusedUncompressedHeap,
|
||||
"Memory used by not in-use chrome images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/chrome/unused/uncompressed-nonheap",
|
||||
REPORT("explicit/images/chrome/raster/unused/uncompressed-nonheap",
|
||||
KIND_NONHEAP, chrome.mUnusedUncompressedNonheap,
|
||||
"Memory used by not in-use chrome images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/content/used/raw",
|
||||
REPORT("explicit/images/content/raster/used/raw",
|
||||
KIND_HEAP, content.mUsedRaw,
|
||||
"Memory used by in-use content images (compressed data).");
|
||||
|
||||
REPORT("explicit/images/content/used/uncompressed-heap",
|
||||
REPORT("explicit/images/content/raster/used/uncompressed-heap",
|
||||
KIND_HEAP, content.mUsedUncompressedHeap,
|
||||
"Memory used by in-use content images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/content/used/uncompressed-nonheap",
|
||||
REPORT("explicit/images/content/raster/used/uncompressed-nonheap",
|
||||
KIND_NONHEAP, content.mUsedUncompressedNonheap,
|
||||
"Memory used by in-use content images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/content/unused/raw",
|
||||
REPORT("explicit/images/content/raster/unused/raw",
|
||||
KIND_HEAP, content.mUnusedRaw,
|
||||
"Memory used by not in-use content images (compressed data).");
|
||||
|
||||
REPORT("explicit/images/content/unused/uncompressed-heap",
|
||||
REPORT("explicit/images/content/raster/unused/uncompressed-heap",
|
||||
KIND_HEAP, content.mUnusedUncompressedHeap,
|
||||
"Memory used by not in-use content images (uncompressed data).");
|
||||
|
||||
REPORT("explicit/images/content/unused/uncompressed-nonheap",
|
||||
REPORT("explicit/images/content/raster/unused/uncompressed-nonheap",
|
||||
KIND_NONHEAP, content.mUnusedUncompressedNonheap,
|
||||
"Memory used by not in-use content images (uncompressed data).");
|
||||
|
||||
#undef REPORT
|
||||
|
||||
#define REPORT_VECTOR(_path, _uri, _amount, _desc) \
|
||||
do { \
|
||||
nsAutoCString path(NS_LITERAL_CSTRING(_path)); \
|
||||
path.Append("/("); \
|
||||
path.Append(_uri); \
|
||||
path.Append(")"); \
|
||||
nsresult rv; \
|
||||
rv = callback->Callback(EmptyCString(), path, \
|
||||
KIND_HEAP, UNITS_BYTES, _amount, \
|
||||
NS_LITERAL_CSTRING(_desc), closure); \
|
||||
NS_ENSURE_SUCCESS(rv, rv); \
|
||||
} while (0)
|
||||
|
||||
for (uint32_t i = 0; i < chrome.mVectorImageDocInfo.Length(); i++) {
|
||||
chrome.mVectorImageDocInfo[i].mURI.ReplaceChar('/', '\\');
|
||||
if (chrome.mVectorImageDocInfo[i].mUsed) {
|
||||
REPORT_VECTOR("explicit/images/chrome/vector/used/documents",
|
||||
chrome.mVectorImageDocInfo[i].mURI,
|
||||
chrome.mVectorImageDocInfo[i].mSize,
|
||||
"Memory used by in-use chrome vector images for their parsed vector documents.");
|
||||
} else {
|
||||
REPORT_VECTOR("explicit/images/chrome/vector/unused/documents",
|
||||
chrome.mVectorImageDocInfo[i].mURI,
|
||||
chrome.mVectorImageDocInfo[i].mSize,
|
||||
"Memory used by not in-use chrome vector images for their parsed vector documents.");
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < content.mVectorImageDocInfo.Length(); i++) {
|
||||
content.mVectorImageDocInfo[i].mURI.ReplaceChar('/', '\\');
|
||||
if (content.mVectorImageDocInfo[i].mUsed) {
|
||||
REPORT_VECTOR("explicit/images/content/vector/used/documents",
|
||||
content.mVectorImageDocInfo[i].mURI,
|
||||
content.mVectorImageDocInfo[i].mSize,
|
||||
"Memory used by in-use content vector images for their parsed vector documents.");
|
||||
} else {
|
||||
REPORT_VECTOR("explicit/images/content/vector/unused/documents",
|
||||
content.mVectorImageDocInfo[i].mURI,
|
||||
content.mVectorImageDocInfo[i].mSize,
|
||||
"Memory used by not in-use content vector images for their parsed vector documents.");
|
||||
}
|
||||
}
|
||||
|
||||
#undef REPORT_VECTOR
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -150,6 +195,12 @@ public:
|
||||
private:
|
||||
nsTArray<imgLoader*> mKnownLoaders;
|
||||
|
||||
struct VectorImageDocInfo {
|
||||
size_t mSize;
|
||||
bool mUsed;
|
||||
nsCString mURI;
|
||||
};
|
||||
|
||||
struct AllSizes {
|
||||
size_t mUsedRaw;
|
||||
size_t mUsedUncompressedHeap;
|
||||
@ -157,10 +208,18 @@ private:
|
||||
size_t mUnusedRaw;
|
||||
size_t mUnusedUncompressedHeap;
|
||||
size_t mUnusedUncompressedNonheap;
|
||||
// The size of VectorImages' documents are recorded individually so that we
|
||||
// can report on each SVG-as-an-image individually.
|
||||
nsTArray<VectorImageDocInfo> mVectorImageDocInfo;
|
||||
|
||||
AllSizes() {
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
AllSizes()
|
||||
: mUsedRaw(0)
|
||||
, mUsedUncompressedHeap(0)
|
||||
, mUsedUncompressedNonheap(0)
|
||||
, mUnusedRaw(0)
|
||||
, mUnusedUncompressedHeap(0)
|
||||
, mUnusedUncompressedNonheap(0)
|
||||
{}
|
||||
};
|
||||
|
||||
static PLDHashOperator EntryAllSizes(const nsACString&,
|
||||
@ -184,6 +243,12 @@ private:
|
||||
image->HeapSizeOfDecodedWithComputedFallback(ImagesMallocSizeOf);
|
||||
sizes->mUsedUncompressedNonheap += image->NonHeapSizeOfDecoded();
|
||||
}
|
||||
VectorImageDocInfo vectInfo;
|
||||
vectInfo.mSize = image->HeapSizeOfVectorImageDocument(&vectInfo.mURI);
|
||||
if (!vectInfo.mURI.IsEmpty()) {
|
||||
vectInfo.mUsed = !entry->HasNoProxies();
|
||||
sizes->mVectorImageDocInfo.AppendElement(vectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nsLocaleConstructors.h"
|
||||
|
||||
// uconv
|
||||
#include "nsCharsetConverterManager.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker)
|
||||
@ -135,12 +134,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static void
|
||||
I18nModuleDtor()
|
||||
{
|
||||
nsCharsetConverterManager::Shutdown();
|
||||
}
|
||||
|
||||
static const mozilla::Module kIntlModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kIntlCIDs,
|
||||
@ -148,7 +141,7 @@ static const mozilla::Module kIntlModule = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
I18nModuleDtor
|
||||
nullptr
|
||||
};
|
||||
|
||||
NSMODULE_DEFN(nsI18nModule) = &kIntlModule;
|
||||
|
@ -5,7 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS += [
|
||||
'nsCharsetAlias.h',
|
||||
'nsCollationCID.h',
|
||||
'nsDateTimeFormatCID.h',
|
||||
'nsIDateTimeFormat.h',
|
||||
|
@ -1,25 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsCharsetAlias_h___
|
||||
#define nsCharsetAlias_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsCharsetConverterManager;
|
||||
class nsScriptableUnicodeConverter;
|
||||
|
||||
class nsCharsetAlias
|
||||
{
|
||||
friend class nsCharsetConverterManager;
|
||||
friend class nsScriptableUnicodeConverter;
|
||||
static nsresult GetPreferredInternal(const nsACString& aAlias, nsACString& aResult);
|
||||
public:
|
||||
static nsresult GetPreferred(const nsACString& aAlias, nsACString& aResult);
|
||||
static nsresult Equals(const nsACString& aCharset1, const nsACString& aCharset2, bool* aResult);
|
||||
};
|
||||
|
||||
#endif /* nsCharsetAlias_h___ */
|
@ -17,8 +17,8 @@
|
||||
#include "nsIAtom.h"
|
||||
|
||||
#define NS_ILANGUAGEATOMSERVICE_IID \
|
||||
{0xAF4C48CF, 0x8F76, 0x4477, \
|
||||
{ 0xA7, 0x0E, 0xAB, 0x09, 0x74, 0xE2, 0x41, 0xF0 }}
|
||||
{0xcb3892a0, 0x6a76, 0x461c, \
|
||||
{ 0xb0, 0x24, 0x23, 0x0e, 0xe3, 0xe0, 0x81, 0x1a }}
|
||||
|
||||
#define NS_LANGUAGEATOMSERVICE_CONTRACTID \
|
||||
"@mozilla.org/intl/nslanguageatomservice;1"
|
||||
@ -31,7 +31,7 @@ class nsILanguageAtomService : public nsISupports
|
||||
virtual nsIAtom* LookupLanguage(const nsACString &aLanguage,
|
||||
nsresult *aError = nullptr) = 0;
|
||||
virtual already_AddRefed<nsIAtom>
|
||||
LookupCharSet(const char *aCharSet, nsresult *aError = nullptr) = 0;
|
||||
LookupCharSet(const nsACString& aCharSet) = 0;
|
||||
|
||||
virtual nsIAtom* GetLocaleLanguage(nsresult *aError = nullptr) = 0;
|
||||
|
||||
|
@ -9,6 +9,3 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
charsetalias.properties.h: props2arrays.py charsetalias.properties
|
||||
$(PYTHON) $^ $@
|
||||
|
||||
|
@ -1,460 +0,0 @@
|
||||
# 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/.
|
||||
#
|
||||
# This Original Code has been modified by IBM Corporation.
|
||||
# Modifications made by IBM described herein are
|
||||
# Copyright (c) International Business Machines
|
||||
# Corporation, 1999
|
||||
#
|
||||
# Modifications to Mozilla code or documentation
|
||||
# identified per MPL Section 3.3
|
||||
#
|
||||
# Date Modified by Description of modification
|
||||
# 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
||||
#
|
||||
# Rule of this file:
|
||||
# 1. key should always be in lower case ascii so we can do case insensitive
|
||||
# comparison in the code faster.
|
||||
# 2. value should be the one used in unicode converter
|
||||
#
|
||||
# 3. If the charset is not used for document charset, but font charset
|
||||
# (e.g. XLFD charset- such as JIS x0201, JIS x0208), don't put here
|
||||
#
|
||||
|
||||
ascii=us-ascii
|
||||
us-ascii=us-ascii
|
||||
ansi_x3.4-1968=us-ascii
|
||||
646=us-ascii
|
||||
iso-8859-1=ISO-8859-1
|
||||
iso-8859-2=ISO-8859-2
|
||||
iso-8859-3=ISO-8859-3
|
||||
iso-8859-4=ISO-8859-4
|
||||
iso-8859-5=ISO-8859-5
|
||||
iso-8859-6=ISO-8859-6
|
||||
iso-8859-6-i=ISO-8859-6-I
|
||||
iso-8859-6-e=ISO-8859-6-E
|
||||
iso-8859-7=ISO-8859-7
|
||||
iso-8859-8=ISO-8859-8
|
||||
iso-8859-8-i=ISO-8859-8-I
|
||||
iso-8859-8-e=ISO-8859-8-E
|
||||
iso-8859-9=ISO-8859-9
|
||||
iso-8859-10=ISO-8859-10
|
||||
iso-8859-11=ISO-8859-11
|
||||
iso-8859-13=ISO-8859-13
|
||||
iso-8859-14=ISO-8859-14
|
||||
iso-8859-15=ISO-8859-15
|
||||
iso-8859-16=ISO-8859-16
|
||||
iso-ir-111=ISO-IR-111
|
||||
iso-2022-cn=ISO-2022-CN
|
||||
iso-2022-cn-ext=ISO-2022-CN
|
||||
iso-2022-kr=ISO-2022-KR
|
||||
iso-2022-jp=ISO-2022-JP
|
||||
utf-16be=UTF-16BE
|
||||
utf-16le=UTF-16LE
|
||||
utf-16=UTF-16
|
||||
windows-1250=windows-1250
|
||||
windows-1251=windows-1251
|
||||
windows-1252=windows-1252
|
||||
windows-1253=windows-1253
|
||||
windows-1254=windows-1254
|
||||
windows-1255=windows-1255
|
||||
windows-1256=windows-1256
|
||||
windows-1257=windows-1257
|
||||
windows-1258=windows-1258
|
||||
ibm866=IBM866
|
||||
ibm850=IBM850
|
||||
ibm852=IBM852
|
||||
ibm855=IBM855
|
||||
ibm857=IBM857
|
||||
ibm862=IBM862
|
||||
ibm864=IBM864
|
||||
utf-8=UTF-8
|
||||
utf-7=UTF-7
|
||||
shift_jis=Shift_JIS
|
||||
big5=Big5
|
||||
euc-jp=EUC-JP
|
||||
euc-kr=EUC-KR
|
||||
gb2312=GB2312
|
||||
gb18030=gb18030
|
||||
viscii=VISCII
|
||||
koi8-r=KOI8-R
|
||||
koi8_r=KOI8-R
|
||||
cskoi8r=KOI8-R
|
||||
koi=KOI8-R
|
||||
koi8=KOI8-R
|
||||
koi8-u=KOI8-U
|
||||
tis-620=TIS-620
|
||||
t.61-8bit=T.61-8bit
|
||||
hz-gb-2312=HZ-GB-2312
|
||||
big5-hkscs=Big5-HKSCS
|
||||
gbk=gbk
|
||||
cns11643=x-euc-tw
|
||||
#
|
||||
# Netscape private ...
|
||||
#
|
||||
x-imap4-modified-utf7=x-imap4-modified-utf7
|
||||
x-euc-tw=x-euc-tw
|
||||
x-mac-ce=x-mac-ce
|
||||
x-mac-turkish=x-mac-turkish
|
||||
x-mac-greek=x-mac-greek
|
||||
x-mac-icelandic=x-mac-icelandic
|
||||
x-mac-croatian=x-mac-croatian
|
||||
x-mac-romanian=x-mac-romanian
|
||||
x-mac-cyrillic=x-mac-cyrillic
|
||||
x-mac-ukrainian=x-mac-cyrillic
|
||||
x-mac-hebrew=x-mac-hebrew
|
||||
x-mac-arabic=x-mac-arabic
|
||||
x-mac-farsi=x-mac-farsi
|
||||
x-mac-devanagari=x-mac-devanagari
|
||||
x-mac-gujarati=x-mac-gujarati
|
||||
x-mac-gurmukhi=x-mac-gurmukhi
|
||||
armscii-8=armscii-8
|
||||
x-viet-tcvn5712=x-viet-tcvn5712
|
||||
x-viet-vps=x-viet-vps
|
||||
iso-10646-ucs-2=UTF-16BE
|
||||
x-iso-10646-ucs-2-be=UTF-16BE
|
||||
x-iso-10646-ucs-2-le=UTF-16LE
|
||||
x-user-defined=x-user-defined
|
||||
x-johab=x-johab
|
||||
#
|
||||
# Aliases for ISO-8859-1
|
||||
#
|
||||
latin1=ISO-8859-1
|
||||
iso_8859-1=ISO-8859-1
|
||||
iso8859-1=ISO-8859-1
|
||||
iso8859-2=ISO-8859-2
|
||||
iso8859-3=ISO-8859-3
|
||||
iso8859-4=ISO-8859-4
|
||||
iso8859-5=ISO-8859-5
|
||||
iso8859-6=ISO-8859-6
|
||||
iso8859-7=ISO-8859-7
|
||||
iso8859-8=ISO-8859-8
|
||||
iso8859-9=ISO-8859-9
|
||||
iso8859-10=ISO-8859-10
|
||||
iso8859-11=ISO-8859-11
|
||||
iso8859-13=ISO-8859-13
|
||||
iso8859-14=ISO-8859-14
|
||||
iso8859-15=ISO-8859-15
|
||||
iso_8859-1:1987=ISO-8859-1
|
||||
iso-ir-100=ISO-8859-1
|
||||
l1=ISO-8859-1
|
||||
ibm819=ISO-8859-1
|
||||
cp819=ISO-8859-1
|
||||
csisolatin1=ISO-8859-1
|
||||
#
|
||||
# Aliases for ISO-8859-2
|
||||
#
|
||||
latin2=ISO-8859-2
|
||||
iso_8859-2=ISO-8859-2
|
||||
iso_8859-2:1987=ISO-8859-2
|
||||
iso-ir-101=ISO-8859-2
|
||||
l2=ISO-8859-2
|
||||
csisolatin2=ISO-8859-2
|
||||
#
|
||||
# Aliases for ISO-8859-3
|
||||
#
|
||||
latin3=ISO-8859-3
|
||||
iso_8859-3=ISO-8859-3
|
||||
iso_8859-3:1988=ISO-8859-3
|
||||
iso-ir-109=ISO-8859-3
|
||||
l3=ISO-8859-3
|
||||
csisolatin3=ISO-8859-3
|
||||
#
|
||||
# Aliases for ISO-8859-4
|
||||
#
|
||||
latin4=ISO-8859-4
|
||||
iso_8859-4=ISO-8859-4
|
||||
iso_8859-4:1988=ISO-8859-4
|
||||
iso-ir-110=ISO-8859-4
|
||||
l4=ISO-8859-4
|
||||
csisolatin4=ISO-8859-4
|
||||
#
|
||||
# Aliases for ISO-8859-5
|
||||
#
|
||||
cyrillic=ISO-8859-5
|
||||
iso_8859-5=ISO-8859-5
|
||||
iso_8859-5:1988=ISO-8859-5
|
||||
iso-ir-144=ISO-8859-5
|
||||
csisolatincyrillic=ISO-8859-5
|
||||
#
|
||||
# Aliases for ISO-8859-6
|
||||
#
|
||||
arabic=ISO-8859-6
|
||||
iso_8859-6=ISO-8859-6
|
||||
iso_8859-6:1987=ISO-8859-6
|
||||
iso-ir-127=ISO-8859-6
|
||||
ecma-114=ISO-8859-6
|
||||
asmo-708=ISO-8859-6
|
||||
csisolatinarabic=ISO-8859-6
|
||||
#
|
||||
# Aliases for ISO-8859-6-I
|
||||
#
|
||||
csiso88596i=ISO-8859-6-I
|
||||
#
|
||||
# Aliases for ISO-8859-6-E
|
||||
#
|
||||
csiso88596e=ISO-8859-6-E
|
||||
#
|
||||
# Aliases for ISO-8859-7
|
||||
#
|
||||
greek=ISO-8859-7
|
||||
greek8=ISO-8859-7
|
||||
sun_eu_greek=ISO-8859-7
|
||||
iso_8859-7=ISO-8859-7
|
||||
iso_8859-7:1987=ISO-8859-7
|
||||
iso-ir-126=ISO-8859-7
|
||||
elot_928=ISO-8859-7
|
||||
ecma-118=ISO-8859-7
|
||||
csisolatingreek=ISO-8859-7
|
||||
#
|
||||
# Aliases for ISO-8859-8
|
||||
#
|
||||
hebrew=ISO-8859-8
|
||||
iso_8859-8=ISO-8859-8
|
||||
visual=ISO-8859-8
|
||||
iso_8859-8:1988=ISO-8859-8
|
||||
iso-ir-138=ISO-8859-8
|
||||
csisolatinhebrew=ISO-8859-8
|
||||
#
|
||||
# Aliases for ISO-8859-8-I
|
||||
#
|
||||
csiso88598i=ISO-8859-8-I
|
||||
iso-8859-8i=ISO-8859-8-I
|
||||
logical=ISO-8859-8-I
|
||||
#
|
||||
# Aliases for ISO-8859-8-E
|
||||
#
|
||||
csiso88598e=ISO-8859-8-E
|
||||
#
|
||||
# Aliases for ISO-8859-9
|
||||
#
|
||||
latin5=ISO-8859-9
|
||||
iso_8859-9=ISO-8859-9
|
||||
iso_8859-9:1989=ISO-8859-9
|
||||
iso-ir-148=ISO-8859-9
|
||||
l5=ISO-8859-9
|
||||
csisolatin5=ISO-8859-9
|
||||
#
|
||||
# Aliases for UTF-8
|
||||
#
|
||||
unicode-1-1-utf-8=UTF-8
|
||||
# nl_langinfo(CODESET) in HP/UX returns 'utf8' under UTF-8 locales
|
||||
utf8=UTF-8
|
||||
#
|
||||
# Aliases for Shift_JIS
|
||||
#
|
||||
x-sjis=Shift_JIS
|
||||
shift-jis=Shift_JIS
|
||||
ms_kanji=Shift_JIS
|
||||
csshiftjis=Shift_JIS
|
||||
windows-31j=Shift_JIS
|
||||
cp932=Shift_JIS
|
||||
sjis=Shift_JIS
|
||||
#
|
||||
# Aliases for EUC_JP
|
||||
#
|
||||
cseucpkdfmtjapanese=EUC-JP
|
||||
x-euc-jp=EUC-JP
|
||||
#
|
||||
# Aliases for ISO-2022-JP
|
||||
#
|
||||
csiso2022jp=ISO-2022-JP
|
||||
# The following are really not aliases ISO-2022-JP, but sharing the same decoder
|
||||
iso-2022-jp-2=ISO-2022-JP
|
||||
csiso2022jp2=ISO-2022-JP
|
||||
#
|
||||
# Aliases for Big5
|
||||
#
|
||||
csbig5=Big5
|
||||
cn-big5=Big5
|
||||
# x-x-big5 is not really a alias for Big5, add it only for MS FrontPage
|
||||
x-x-big5=Big5
|
||||
# Sun Solaris
|
||||
zh_tw-big5=Big5
|
||||
#
|
||||
# Aliases for EUC-KR
|
||||
#
|
||||
cseuckr=EUC-KR
|
||||
ks_c_5601-1987=EUC-KR
|
||||
iso-ir-149=EUC-KR
|
||||
ks_c_5601-1989=EUC-KR
|
||||
ksc_5601=EUC-KR
|
||||
ksc5601=EUC-KR
|
||||
korean=EUC-KR
|
||||
csksc56011987=EUC-KR
|
||||
5601=EUC-KR
|
||||
windows-949=EUC-KR
|
||||
#
|
||||
# Aliases for GB2312
|
||||
#
|
||||
# The following are really not aliases GB2312, add them only for MS FrontPage
|
||||
gb_2312-80=GB2312
|
||||
iso-ir-58=GB2312
|
||||
chinese=GB2312
|
||||
csiso58gb231280=GB2312
|
||||
csgb2312=GB2312
|
||||
zh_cn.euc=GB2312
|
||||
# Sun Solaris
|
||||
gb_2312=GB2312
|
||||
#
|
||||
# Aliases for windows-125x
|
||||
#
|
||||
x-cp1250=windows-1250
|
||||
x-cp1251=windows-1251
|
||||
x-cp1252=windows-1252
|
||||
x-cp1253=windows-1253
|
||||
x-cp1254=windows-1254
|
||||
x-cp1255=windows-1255
|
||||
x-cp1256=windows-1256
|
||||
x-cp1257=windows-1257
|
||||
x-cp1258=windows-1258
|
||||
#
|
||||
# Aliases for windows-874
|
||||
#
|
||||
windows-874=windows-874
|
||||
ibm874=windows-874
|
||||
dos-874=windows-874
|
||||
#
|
||||
# Aliases for macintosh
|
||||
#
|
||||
macintosh=macintosh
|
||||
x-mac-roman=macintosh
|
||||
mac=macintosh
|
||||
csmacintosh=macintosh
|
||||
#
|
||||
# Aliases for IBM866
|
||||
#
|
||||
cp866=IBM866
|
||||
cp-866=IBM866
|
||||
866=IBM866
|
||||
csibm866=IBM866
|
||||
#
|
||||
# Aliases for IBM850
|
||||
#
|
||||
cp850=IBM850
|
||||
850=IBM850
|
||||
csibm850=IBM850
|
||||
#
|
||||
# Aliases for IBM852
|
||||
#
|
||||
cp852=IBM852
|
||||
852=IBM852
|
||||
csibm852=IBM852
|
||||
#
|
||||
# Aliases for IBM855
|
||||
#
|
||||
cp855=IBM855
|
||||
855=IBM855
|
||||
csibm855=IBM855
|
||||
#
|
||||
# Aliases for IBM857
|
||||
#
|
||||
cp857=IBM857
|
||||
857=IBM857
|
||||
csibm857=IBM857
|
||||
#
|
||||
# Aliases for IBM862
|
||||
#
|
||||
cp862=IBM862
|
||||
862=IBM862
|
||||
csibm862=IBM862
|
||||
#
|
||||
# Aliases for IBM864
|
||||
#
|
||||
cp864=IBM864
|
||||
864=IBM864
|
||||
csibm864=IBM864
|
||||
ibm-864=IBM864
|
||||
#
|
||||
# Aliases for T.61-8bit
|
||||
#
|
||||
t.61=T.61-8bit
|
||||
iso-ir-103=T.61-8bit
|
||||
csiso103t618bit=T.61-8bit
|
||||
#
|
||||
# Aliases for UTF-7
|
||||
#
|
||||
x-unicode-2-0-utf-7=UTF-7
|
||||
unicode-2-0-utf-7=UTF-7
|
||||
unicode-1-1-utf-7=UTF-7
|
||||
csunicode11utf7=UTF-7
|
||||
#
|
||||
# Aliases for ISO-10646-UCS-2
|
||||
#
|
||||
csunicode=UTF-16BE
|
||||
csunicode11=UTF-16BE
|
||||
iso-10646-ucs-basic=UTF-16BE
|
||||
csunicodeascii=UTF-16BE
|
||||
iso-10646-unicode-latin1=UTF-16BE
|
||||
csunicodelatin1=UTF-16BE
|
||||
iso-10646=UTF-16BE
|
||||
iso-10646-j-1=UTF-16BE
|
||||
#
|
||||
# Aliases for ISO-8859-10
|
||||
#
|
||||
latin6=ISO-8859-10
|
||||
iso-ir-157=ISO-8859-10
|
||||
l6=ISO-8859-10
|
||||
# Currently .properties cannot handle : in key
|
||||
#iso_8859-10:1992=ISO-8859-10
|
||||
csisolatin6=ISO-8859-10
|
||||
#
|
||||
# Aliases for ISO-8859-15
|
||||
#
|
||||
iso_8859-15=ISO-8859-15
|
||||
csisolatin9=ISO-8859-15
|
||||
l9=ISO-8859-15
|
||||
#
|
||||
# Aliases for ISO-IR-111
|
||||
#
|
||||
ecma-cyrillic=ISO-IR-111
|
||||
csiso111ecmacyrillic=ISO-IR-111
|
||||
#
|
||||
# Aliases for ISO-2022-KR
|
||||
#
|
||||
csiso2022kr=ISO-2022-KR
|
||||
#
|
||||
# Aliases for VISCII
|
||||
#
|
||||
csviscii=VISCII
|
||||
#
|
||||
# Aliases for x-euc-tw
|
||||
#
|
||||
zh_tw-euc=x-euc-tw
|
||||
#
|
||||
# Following names appears in unix nl_langinfo(CODESET)
|
||||
# They can be compiled as platform specific if necessary
|
||||
# DONT put things here if it does not look generic enough (like hp15CN)
|
||||
#
|
||||
iso88591=ISO-8859-1
|
||||
iso88592=ISO-8859-2
|
||||
iso88593=ISO-8859-3
|
||||
iso88594=ISO-8859-4
|
||||
iso88595=ISO-8859-5
|
||||
iso88596=ISO-8859-6
|
||||
iso88597=ISO-8859-7
|
||||
iso88598=ISO-8859-8
|
||||
iso88599=ISO-8859-9
|
||||
iso885910=ISO-8859-10
|
||||
iso885911=ISO-8859-11
|
||||
iso885912=ISO-8859-12
|
||||
iso885913=ISO-8859-13
|
||||
iso885914=ISO-8859-14
|
||||
iso885915=ISO-8859-15
|
||||
#
|
||||
tis620=TIS-620
|
||||
#
|
||||
cp1250=windows-1250
|
||||
cp1251=windows-1251
|
||||
cp1252=windows-1252
|
||||
cp1253=windows-1253
|
||||
cp1254=windows-1254
|
||||
cp1255=windows-1255
|
||||
cp1256=windows-1256
|
||||
cp1257=windows-1257
|
||||
cp1258=windows-1258
|
||||
|
||||
x-gbk=gbk
|
||||
windows-936=gbk
|
||||
ansi-1251=windows-1251
|
@ -18,7 +18,6 @@ EXPORTS += [
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsCharsetAlias.cpp',
|
||||
'nsCollation.cpp',
|
||||
'nsLanguageAtomService.cpp',
|
||||
'nsLocale.cpp',
|
||||
@ -35,10 +34,6 @@ MSVC_ENABLE_PGO = True
|
||||
|
||||
FINAL_LIBRARY = 'i18n'
|
||||
|
||||
GENERATED_FILES = [
|
||||
'charsetalias.properties.h',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/intl/uconv/src',
|
||||
]
|
||||
|
@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
|
||||
#include "nsCharsetAlias.h"
|
||||
|
||||
// for NS_ERROR_UCONV_NOCONV
|
||||
#include "nsCharsetConverterManager.h"
|
||||
|
||||
#include "nsUConvPropertySearch.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//
|
||||
static const char* kAliases[][3] = {
|
||||
#include "charsetalias.properties.h"
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// static
|
||||
nsresult
|
||||
nsCharsetAlias::GetPreferredInternal(const nsACString& aAlias,
|
||||
nsACString& oResult)
|
||||
{
|
||||
nsAutoCString key(aAlias);
|
||||
ToLowerCase(key);
|
||||
|
||||
return nsUConvPropertySearch::SearchPropertyValue(kAliases,
|
||||
ArrayLength(kAliases), key, oResult);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// static
|
||||
nsresult
|
||||
nsCharsetAlias::GetPreferred(const nsACString& aAlias,
|
||||
nsACString& oResult)
|
||||
{
|
||||
if (aAlias.IsEmpty()) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = GetPreferredInternal(aAlias, oResult);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
if (nsCharsetConverterManager::IsInternal(oResult))
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// static
|
||||
nsresult
|
||||
nsCharsetAlias::Equals(const nsACString& aCharset1,
|
||||
const nsACString& aCharset2, bool* oResult)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if(aCharset1.Equals(aCharset2, nsCaseInsensitiveCStringComparator())) {
|
||||
*oResult = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
if(aCharset1.IsEmpty() || aCharset2.IsEmpty()) {
|
||||
*oResult = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
*oResult = false;
|
||||
nsAutoCString name1;
|
||||
res = GetPreferredInternal(aCharset1, name1);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsAutoCString name2;
|
||||
res = GetPreferredInternal(aCharset2, name2);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
*oResult = name1.Equals(name2);
|
||||
return NS_OK;
|
||||
}
|
@ -8,8 +8,10 @@
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -73,13 +75,13 @@ nsresult nsCollation::SetCharset(const char* aCharset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharset);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsICharsetConverterManager> charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = charsetConverterManager->GetUnicodeEncoder(aCharset,
|
||||
getter_AddRefs(mEncoder));
|
||||
nsDependentCString label(aCharset);
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
return rv;
|
||||
mEncoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCollation::UnicodeToChar(const nsAString& aSrc, char** dst)
|
||||
|
@ -4,12 +4,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsLanguageAtomService.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsLanguageAtomService, nsILanguageAtomService)
|
||||
|
||||
@ -44,31 +44,11 @@ nsLanguageAtomService::LookupLanguage(const nsACString &aLanguage,
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAtom>
|
||||
nsLanguageAtomService::LookupCharSet(const char *aCharSet, nsresult *aError)
|
||||
nsLanguageAtomService::LookupCharSet(const nsACString& aCharSet)
|
||||
{
|
||||
if (!mCharSets) {
|
||||
mCharSets = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID);
|
||||
if (!mCharSets) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> langGroup;
|
||||
mCharSets->GetCharsetLangGroup(aCharSet, getter_AddRefs(langGroup));
|
||||
if (!langGroup) {
|
||||
if (aError)
|
||||
*aError = NS_ERROR_FAILURE;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aError)
|
||||
*aError = NS_OK;
|
||||
|
||||
return langGroup.forget();
|
||||
nsAutoCString group;
|
||||
mozilla::dom::EncodingUtils::LangGroupForEncoding(aCharSet, group);
|
||||
return do_GetAtom(group);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
@ -4,7 +4,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsILanguageAtomService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
@ -24,7 +23,7 @@ public:
|
||||
LookupLanguage(const nsACString &aLanguage, nsresult *aError);
|
||||
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsIAtom>)
|
||||
LookupCharSet(const char *aCharSet, nsresult *aError);
|
||||
LookupCharSet(const nsACString& aCharSet);
|
||||
|
||||
virtual NS_HIDDEN_(nsIAtom*) GetLocaleLanguage(nsresult *aError);
|
||||
|
||||
@ -39,7 +38,6 @@ private:
|
||||
protected:
|
||||
NS_HIDDEN_(nsresult) InitLangGroupTable();
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> mCharSets;
|
||||
nsInterfaceHashtable<nsISupportsHashKey, nsIAtom> mLangToGroup;
|
||||
nsCOMPtr<nsIStringBundle> mLangGroups;
|
||||
nsCOMPtr<nsIAtom> mLocaleLanguage;
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDateTimeFormatUnix, nsIDateTimeFormat)
|
||||
|
||||
@ -42,7 +45,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale)
|
||||
}
|
||||
}
|
||||
|
||||
mCharset.AssignLiteral("ISO-8859-1");
|
||||
mCharset.AssignLiteral("windows-1252");
|
||||
mPlatformLocale.Assign("en_US");
|
||||
|
||||
// get locale name string, use app default if no locale specified
|
||||
@ -81,12 +84,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize unicode decoder
|
||||
nsCOMPtr <nsICharsetConverterManager> charsetConverterManager;
|
||||
charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = charsetConverterManager->GetUnicodeDecoder(mCharset.get(), getter_AddRefs(mDecoder));
|
||||
}
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
|
||||
LocalePreferred24hour();
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#define nsDateTimeFormatUnix_h__
|
||||
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDateTimeFormat.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
#define kPlatformLocaleLength 64
|
||||
|
||||
|
@ -11,11 +11,6 @@
|
||||
#include "nsUConvPropertySearch.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsEncoderDecoderUtils.h"
|
||||
#if HAVE_GNU_LIBC_VERSION_H
|
||||
#include <gnu/libc-version.h>
|
||||
@ -29,7 +24,9 @@
|
||||
#include "nsPlatformCharset.h"
|
||||
#include "prinit.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using namespace mozilla;
|
||||
|
||||
static const char* kUnixCharsets[][3] = {
|
||||
@ -181,49 +178,11 @@ nsPlatformCharset::VerifyCharset(nsCString &aCharset)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult res;
|
||||
//
|
||||
// get the convert manager
|
||||
//
|
||||
nsCOMPtr <nsICharsetConverterManager> charsetConverterManager;
|
||||
charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
//
|
||||
// check if we can get an input converter
|
||||
//
|
||||
nsCOMPtr <nsIUnicodeEncoder> enc;
|
||||
res = charsetConverterManager->GetUnicodeEncoder(aCharset.get(), getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ERROR("failed to create encoder");
|
||||
return res;
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aCharset, encoding)) {
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
|
||||
//
|
||||
// check if we can get an output converter
|
||||
//
|
||||
nsCOMPtr <nsIUnicodeDecoder> dec;
|
||||
res = charsetConverterManager->GetUnicodeDecoder(aCharset.get(), getter_AddRefs(dec));
|
||||
if (NS_FAILED(res)) {
|
||||
NS_ERROR("failed to create decoder");
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// check if we recognize the charset string
|
||||
//
|
||||
|
||||
nsAutoCString result;
|
||||
res = charsetConverterManager->GetCharsetAlias(aCharset.get(), result);
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// return the preferred string
|
||||
//
|
||||
|
||||
aCharset.Assign(result);
|
||||
aCharset.Assign(encoding);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -16,8 +16,6 @@
|
||||
## The key is "locale.all." + locale name
|
||||
# AIX
|
||||
locale.all.ar_AA=ISO-8859-6
|
||||
# AIX
|
||||
locale.all.Ar_AA=x-IBM1046
|
||||
# Solaris
|
||||
locale.all.Ar_ARM=ISO-8859-6
|
||||
locale.all.american.iso88591=ISO-8859-1
|
||||
@ -116,8 +114,6 @@ locale.all.En_JP=Shift_JIS
|
||||
locale.all.en_KR=EUC-KR
|
||||
locale.all.en_KR.IBM-eucKR=EUC-KR
|
||||
locale.all.en_TH=ISO-8859-1
|
||||
locale.all.en_TW=x-euc-tw
|
||||
locale.all.en_TW.IBM-eucTW=x-euc-tw
|
||||
locale.all.en_US=ISO-8859-1
|
||||
locale.all.en_US.88591=ISO-8859-1
|
||||
locale.all.en_US.ISO8859-1=ISO-8859-1
|
||||
@ -501,7 +497,6 @@ locale.all.sv_SE.iso885915=ISO-8859-15
|
||||
# HP
|
||||
locale.all.sv_SE.iso885915@euro=ISO-8859-15
|
||||
locale.all.sv_SE.ISO8859-1=ISO-8859-1
|
||||
locale.all.Sv_SE=IBM-850
|
||||
# AIX
|
||||
locale.all.swedish.iso88591=ISO-8859-1
|
||||
# Solaris
|
||||
@ -513,7 +508,6 @@ locale.all.th_TH=TIS-620
|
||||
locale.all.th_TH.TIS620=TIS-620
|
||||
locale.all.th=TIS-620
|
||||
locale.all.th_TH.UTF-8=UTF-8
|
||||
locale.all.tchinese=x-euc-tw
|
||||
# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601
|
||||
locale.all.uk_UA=KOI8-U
|
||||
locale.all.zh=GB2312
|
||||
@ -522,9 +516,7 @@ locale.all.zh_CN.EUC=GB2312
|
||||
locale.all.zh.GBK=gbk
|
||||
locale.all.zh_CN.UTF-8=UTF-8
|
||||
locale.all.zh.UTF-8=UTF-8
|
||||
locale.all.zh_TW.EUC=x-euc-tw
|
||||
locale.all.zh_TW.BIG5=Big5
|
||||
locale.all.zh_HK.HKSCS=x-hkscs
|
||||
# saw the following name from news://xcin.linux.org.tw/tlug.cle-devel
|
||||
locale.all.zh_CN.GB2312=GB2312
|
||||
# AIX
|
||||
@ -532,18 +524,10 @@ locale.all.ZH_CN=UTF-8
|
||||
locale.all.zh_CN.ugb=GB2312
|
||||
locale.all.zh_CN.GBK=gbk
|
||||
locale.all.zh_HK.big5=Big5
|
||||
locale.all.zh_HK.eucTW=x-euc-tw
|
||||
locale.all.zh_TW=x-euc-tw
|
||||
locale.all.zh_TW.IBM-eucTW=x-euc-tw
|
||||
locale.all.zh_TW.eucTW=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@chuyin=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@radical=x-euc-tw
|
||||
locale.all.zh_TW.eucTW@stroke=x-euc-tw
|
||||
locale.all.zh_TW.big5=Big5
|
||||
locale.all.zh_TW.big5@chuyin=Big5
|
||||
locale.all.zh_TW.big5@radical=Big5
|
||||
locale.all.zh_TW.big5@stroke=Big5
|
||||
locale.all.zh_TW.ucns=x-euc-tw
|
||||
# AIX
|
||||
locale.all.Zh_TW.big5=Big5
|
||||
# CLE 0.8
|
||||
|
@ -6,7 +6,7 @@
|
||||
# We use this to figure out the charset of file system, clipboard, etc
|
||||
#
|
||||
|
||||
acp.874=TIS-620
|
||||
acp.874=windows-874
|
||||
acp.932=Shift_JIS
|
||||
acp.936=gb18030
|
||||
acp.949=EUC-KR
|
||||
|
@ -5,7 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsICharsetConverterManager.idl',
|
||||
'nsICurrentCharsetListener.idl',
|
||||
'nsIScriptableUConv.idl',
|
||||
'nsITextToSubURI.idl',
|
||||
|
@ -1,110 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 "nsISupports.idl"
|
||||
#include "nsIAtom.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
|
||||
// XXX change to NS_CHARSETCONVERTERMANAGER_CID
|
||||
#define NS_ICHARSETCONVERTERMANAGER_CID \
|
||||
{0x3c1c0163, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
||||
|
||||
#define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1"
|
||||
%}
|
||||
|
||||
interface nsIUnicodeDecoder;
|
||||
interface nsIUnicodeEncoder;
|
||||
interface nsIUTF8StringEnumerator;
|
||||
|
||||
/**
|
||||
* DON'T ADD NEW USES OF THIS INTERFACE TO MOZILLA-CENTRAL. Use
|
||||
* mozilla::dom::EncodingUtils instead.
|
||||
*
|
||||
* Here Charsets are identified by ASCII strings. Charset alias
|
||||
* resolution is provided by default in most methods. "Raw"
|
||||
* versions that do not need this resolution are also provided.
|
||||
*
|
||||
* @deprecated Use mozilla::dom::EncodingUtils in mozilla-central instead.
|
||||
* @created 21/Feb/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
[scriptable, uuid(a0550d46-8d9c-47dd-acc7-c083620dff12)]
|
||||
interface nsICharsetConverterManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the Unicode decoder for the given charset.
|
||||
* The "Raw" version skips charset alias resolution
|
||||
*/
|
||||
[noscript] nsIUnicodeDecoder getUnicodeDecoder(in string charset);
|
||||
[noscript] nsIUnicodeDecoder getUnicodeDecoderRaw(in string charset);
|
||||
[noscript] nsIUnicodeDecoder getUnicodeDecoderInternal(in string charset);
|
||||
|
||||
/**
|
||||
* Get the Unicode encoder for the given charset.
|
||||
* The "Raw" version skips charset alias resolution
|
||||
*/
|
||||
[noscript] nsIUnicodeEncoder getUnicodeEncoder(in string charset);
|
||||
[noscript] nsIUnicodeEncoder getUnicodeEncoderRaw(in string charset);
|
||||
|
||||
/**
|
||||
* A shortcut to calling nsICharsetAlias to do alias resolution
|
||||
* @throws if aCharset is an unknown charset.
|
||||
*/
|
||||
ACString getCharsetAlias(in string aCharset);
|
||||
|
||||
/**
|
||||
* Get the complete list of available decoders.
|
||||
*/
|
||||
nsIUTF8StringEnumerator getDecoderList();
|
||||
|
||||
/**
|
||||
* Get the complete list of available encoders.
|
||||
*/
|
||||
nsIUTF8StringEnumerator getEncoderList();
|
||||
|
||||
/**
|
||||
* Get the complete list of available charset detectors.
|
||||
*/
|
||||
nsIUTF8StringEnumerator GetCharsetDetectorList();
|
||||
|
||||
/**
|
||||
* Get the human-readable name for the given charset.
|
||||
* @throws if aCharset is an unknown charset.
|
||||
*/
|
||||
AString getCharsetTitle(in string aCharset);
|
||||
|
||||
/**
|
||||
* Get some data about the given charset. This includes whether the
|
||||
* character encoding may be used for certain purposes, if it is
|
||||
* multi-byte, and the language code for it. See charsetData.properties
|
||||
* for the source of this data. Some known property names:
|
||||
* notForBrowser - not to be used in the browser.
|
||||
* notForOutgoing - not to be used for exporting files.
|
||||
* LangGroup - language code for charset, e.g. 'he' and 'zh-CN'.
|
||||
* isMultibyte - is this a multi-byte charset?
|
||||
* isInternal - not to be used in untrusted web content.
|
||||
*
|
||||
* @param aCharset name of the character encoding, e.g. 'iso-8859-15'.
|
||||
* @param aProp property desired for the character encoding.
|
||||
* @throws if aCharset is an unknown charset.
|
||||
* @return the value of the property, for the character encoding.
|
||||
*/
|
||||
AString getCharsetData(in string aCharset,
|
||||
in wstring aProp);
|
||||
|
||||
/**
|
||||
* Get the language group for the given charset. This is similar to
|
||||
* calling <tt>getCharsetData</tt> with the <tt>prop</tt> "LangGroup".
|
||||
*
|
||||
* @param aCharset name of the character encoding, e.g. 'iso-8859-15'.
|
||||
* @throws if aCharset is an unknown charset.
|
||||
* @return the language code for the character encoding.
|
||||
*/
|
||||
nsIAtom getCharsetLangGroup(in string aCharset);
|
||||
nsIAtom getCharsetLangGroupRaw(in string aCharset);
|
||||
};
|
@ -73,9 +73,8 @@ interface nsIScriptableUnicodeConverter : nsISupports
|
||||
/**
|
||||
* Internal use
|
||||
*
|
||||
* When this attribute is set, all charsets may be accessed.
|
||||
* When it is not set (the default), charsets with the isInternal flag
|
||||
* may not be accessed.
|
||||
* When this attribute is set, all charsets may be accessed but only
|
||||
* by Gecko-canonical name.
|
||||
*/
|
||||
attribute boolean isInternal;
|
||||
};
|
||||
|
@ -9,9 +9,6 @@
|
||||
#define NS_UNICODEDECODER_NAME "Charset Decoders"
|
||||
#define NS_UNICODEENCODER_NAME "Charset Encoders"
|
||||
|
||||
#define NS_DATA_BUNDLE_CATEGORY "uconv-charset-data"
|
||||
#define NS_TITLE_BUNDLE_CATEGORY "uconv-charset-titles"
|
||||
|
||||
#define NS_CONVERTER_REGISTRY_START \
|
||||
static const mozilla::Module::CategoryEntry kUConvCategories[] = {
|
||||
|
||||
|
@ -1,177 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
## Rule of this file:
|
||||
## 1. key should always be in lower case ascii so we can do case insensitive
|
||||
## comparison in the code faster.
|
||||
|
||||
## Format of this file:
|
||||
##
|
||||
## charset_name.notForOutgoing = anything - specifies that this charset is
|
||||
## not to be used for exporting files ('SaveAsCharset' in composer)
|
||||
##
|
||||
## charset_name.isInternal = anything - specifies that this charset should
|
||||
## not be exposed to web content because of the vulnerability to XSS attacks
|
||||
## or some other reasons
|
||||
##
|
||||
## charset_name.LangGroup =
|
||||
##
|
||||
## charset_name.isMultibyte = multi byte charsets
|
||||
|
||||
x-mac-arabic.isInternal = true
|
||||
x-mac-farsi.isInternal = true
|
||||
x-mac-hebrew.isInternal = true
|
||||
x-imap4-modified-utf7.isInternal = true
|
||||
utf-7.isInternal = true
|
||||
t.61-8bit.isInternal = true
|
||||
ibm864.isInternal = true
|
||||
replacement.isInternal = true
|
||||
|
||||
t.61-8bit.notForOutgoing = true
|
||||
utf-7.notForOutgoing = true
|
||||
x-imap4-modified-utf7.notForOutgoing = true
|
||||
us-ascii.notForOutgoing = true
|
||||
iso-8859-6-e.notForOutgoing = true
|
||||
iso-8859-6-i.notForOutgoing = true
|
||||
ibm864.notForOutgoing = true
|
||||
ibm869.notForOutgoing = true
|
||||
ibm1125.notForOutgoing = true
|
||||
ibm1131.notForOutgoing = true
|
||||
iso-8859-8-e.notForOutgoing = true
|
||||
iso-8859-8.notForOutgoing = true
|
||||
iso-2022-kr.notForOutgoing = true
|
||||
x-johab.notForOutgoing = true
|
||||
replacement.notForOutgoing = true
|
||||
|
||||
# XXX : there are some entries only necessary for Gtk/Xlib builds
|
||||
# to map XLFD registry-encoding pairs to langGroups. they can be
|
||||
# removed once bug 215537 is fixed.
|
||||
|
||||
# XXX : todo: move to something based on BCP 47 (RFC 5646);
|
||||
# these should primarily specify script (and sometimes region),
|
||||
# but NOT language.
|
||||
# See also https://bugzilla.mozilla.org/show_bug.cgi?id=756022
|
||||
# e.g. x-western -> *-Latn-155 (Western Europe)
|
||||
# x-central-euro -> *-Latn-151 (Eastern Europe)
|
||||
# x-baltic -> *-Latn-154 (Northern Europe)
|
||||
# x-cyrillic -> *-Cyrl
|
||||
# zh-TW -> *-Hant-TW
|
||||
# zh-HK -> *-Hant-HK
|
||||
# zh-CN -> *-Hans
|
||||
# ja -> *-Jpan
|
||||
# ko -> *-Hang
|
||||
# tr -> *-Latn-TR
|
||||
# he -> *-Hebr
|
||||
# ar -> *-Arab
|
||||
# etc
|
||||
|
||||
armscii-8.LangGroup = x-armn
|
||||
big5.LangGroup = zh-TW
|
||||
x-x-big5.LangGroup = zh-TW
|
||||
big5-hkscs.LangGroup = zh-HK
|
||||
euc-jp.LangGroup = ja
|
||||
euc-kr.LangGroup = ko
|
||||
gb2312.LangGroup = zh-CN
|
||||
gb18030.LangGroup = zh-CN
|
||||
gb18030.2000-0.LangGroup = zh-CN
|
||||
gb18030.2000-1.LangGroup = zh-CN
|
||||
hkscs-1.LangGroup = zh-HK
|
||||
hz-gb-2312.LangGroup = zh-CN
|
||||
ibm850.LangGroup = x-western
|
||||
ibm852.LangGroup = x-central-euro
|
||||
ibm855.LangGroup = x-cyrillic
|
||||
ibm857.LangGroup = tr
|
||||
ibm862.LangGroup = he
|
||||
ibm864.LangGroup = ar
|
||||
ibm866.LangGroup = x-cyrillic
|
||||
ibm869.LangGroup = el
|
||||
ibm1125.LangGroup = x-cyrillic
|
||||
ibm1131.LangGroup = x-cyrillic
|
||||
iso-2022-cn.LangGroup = zh-CN
|
||||
iso-2022-jp.LangGroup = ja
|
||||
iso-2022-kr.LangGroup = ko
|
||||
iso-8859-1.LangGroup = x-western
|
||||
iso-8859-10.LangGroup = x-western
|
||||
iso-8859-14.LangGroup = x-western
|
||||
iso-8859-15.LangGroup = x-western
|
||||
iso-8859-2.LangGroup = x-central-euro
|
||||
iso-8859-16.LangGroup = x-central-euro
|
||||
iso-8859-3.LangGroup = x-western
|
||||
iso-8859-4.LangGroup = x-baltic
|
||||
iso-8859-13.LangGroup = x-baltic
|
||||
iso-8859-5.LangGroup = x-cyrillic
|
||||
iso-8859-6.LangGroup = ar
|
||||
iso-8859-6-e.LangGroup = ar
|
||||
iso-8859-6-i.LangGroup = ar
|
||||
iso-8859-7.LangGroup = el
|
||||
iso-8859-8.LangGroup = he
|
||||
iso-8859-8-e.LangGroup = he
|
||||
iso-8859-8-i.LangGroup = he
|
||||
iso-8859-9.LangGroup = tr
|
||||
jis_0208-1983.LangGroup = ja
|
||||
koi8-r.LangGroup = x-cyrillic
|
||||
koi8-u.LangGroup = x-cyrillic
|
||||
iso-ir-111.LangGroup = x-cyrillic
|
||||
shift_jis.LangGroup = ja
|
||||
tis-620.LangGroup = th
|
||||
tis620-2.LangGroup = th
|
||||
windows-874.LangGroup = th
|
||||
iso-8859-11.LangGroup = th
|
||||
us-ascii.LangGroup = x-western
|
||||
t.61-8bit.LangGroup = x-western
|
||||
utf-8.LangGroup = x-unicode
|
||||
utf-16.LangGroup = x-unicode
|
||||
utf-16be.LangGroup = x-unicode
|
||||
utf-16le.LangGroup = x-unicode
|
||||
utf-7.LangGroup = x-unicode
|
||||
x-imap4-modified-utf7.LangGroup = x-unicode
|
||||
replacement.LangGroup = x-unicode
|
||||
viscii.LangGroup = x-western
|
||||
x-viet-tcvn5712.LangGroup = x-western
|
||||
x-viet-vps.LangGroup = x-western
|
||||
windows-1250.LangGroup = x-central-euro
|
||||
windows-1251.LangGroup = x-cyrillic
|
||||
windows-1252.LangGroup = x-western
|
||||
windows-1253.LangGroup = el
|
||||
windows-1254.LangGroup = tr
|
||||
windows-1255.LangGroup = he
|
||||
windows-1256.LangGroup = ar
|
||||
windows-1257.LangGroup = x-baltic
|
||||
windows-1258.LangGroup = x-western
|
||||
x-euc-tw.LangGroup = zh-TW
|
||||
gbk.LangGroup = zh-CN
|
||||
gb_2312-80.LangGroup = zh-CN
|
||||
x-mac-ce.LangGroup = x-central-euro
|
||||
x-mac-croatian.LangGroup = x-central-euro
|
||||
x-mac-cyrillic.LangGroup = x-cyrillic
|
||||
x-mac-devanagari.LangGroup = x-devanagari
|
||||
x-mac-farsi.LangGroup = ar
|
||||
x-mac-greek.LangGroup = el
|
||||
x-mac-gujarati.LangGroup = x-gujr
|
||||
x-mac-gurmukhi.LangGroup = x-guru
|
||||
x-mac-icelandic.LangGroup = x-western
|
||||
macintosh.LangGroup = x-western
|
||||
x-mac-turkish.LangGroup = tr
|
||||
x-mac-ukrainian.LangGroup = x-cyrillic
|
||||
x-mac-romanian.LangGroup = x-central-euro
|
||||
x-user-defined.LangGroup = x-unicode
|
||||
ks_c_5601-1987.LangGroup = ko
|
||||
x-johab.LangGroup = ko
|
||||
x-mac-hebrew.LangGroup = he
|
||||
x-mac-arabic.LangGroup = ar
|
||||
|
||||
iso-2022-jp.isMultibyte = true
|
||||
shift_jis.isMultibyte = true
|
||||
euc-jp.isMultibyte = true
|
||||
big5.isMultibyte = true
|
||||
big5-hkscs.isMultibyte = true
|
||||
x-euc-tw.isMultibyte = true
|
||||
gb2312.isMultibyte = true
|
||||
hz-gb-2312.isMultibyte = true
|
||||
iso-2022-kr.isMultibyte = true
|
||||
euc-kr.isMultibyte = true
|
||||
x-johab.isMultibyte = true
|
||||
utf-7.isMultibyte = true
|
||||
utf-8.isMultibyte = true
|
||||
replacement.isMultibyte = true
|
@ -1,6 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
toolkit.jar:
|
||||
res/charsetData.properties (charsetData.properties)
|
@ -5,7 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsCharsetConverterManager.cpp',
|
||||
'nsConverterInputStream.cpp',
|
||||
'nsConverterOutputStream.cpp',
|
||||
'nsCP1252ToUnicode.cpp',
|
||||
@ -215,4 +214,3 @@ LOCAL_INCLUDES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
@ -1,356 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCharsetAlias.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsEncoderDecoderUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsStringEnumerator.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
// just for CONTRACTIDs
|
||||
#include "nsCharsetConverterManager.h"
|
||||
|
||||
static nsIStringBundle * sDataBundle;
|
||||
static nsIStringBundle * sTitleBundle;
|
||||
|
||||
// Class nsCharsetConverterManager [implementation]
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsCharsetConverterManager, nsICharsetConverterManager)
|
||||
|
||||
nsCharsetConverterManager::nsCharsetConverterManager()
|
||||
{
|
||||
}
|
||||
|
||||
nsCharsetConverterManager::~nsCharsetConverterManager()
|
||||
{
|
||||
}
|
||||
|
||||
//static
|
||||
void nsCharsetConverterManager::Shutdown()
|
||||
{
|
||||
NS_IF_RELEASE(sDataBundle);
|
||||
NS_IF_RELEASE(sTitleBundle);
|
||||
}
|
||||
|
||||
static
|
||||
nsresult LoadExtensibleBundle(const char* aCategory,
|
||||
nsIStringBundle ** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> sbServ =
|
||||
mozilla::services::GetStringBundleService();
|
||||
if (!sbServ)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return sbServ->CreateExtensibleBundle(aCategory, aResult);
|
||||
}
|
||||
|
||||
static
|
||||
nsresult GetBundleValue(nsIStringBundle * aBundle,
|
||||
const char * aName,
|
||||
const nsAFlatString& aProp,
|
||||
char16_t ** aResult)
|
||||
{
|
||||
nsAutoString key;
|
||||
|
||||
key.AssignWithConversion(aName);
|
||||
ToLowerCase(key); // we lowercase the main comparison key
|
||||
key.Append(aProp);
|
||||
|
||||
return aBundle->GetStringFromName(key.get(), aResult);
|
||||
}
|
||||
|
||||
static
|
||||
nsresult GetBundleValue(nsIStringBundle * aBundle,
|
||||
const char * aName,
|
||||
const nsAFlatString& aProp,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsXPIDLString value;
|
||||
rv = GetBundleValue(aBundle, aName, aProp, getter_Copies(value));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
aResult = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
nsresult GetCharsetDataImpl(const char * aCharset, const char16_t * aProp,
|
||||
nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharset);
|
||||
// aProp can be nullptr
|
||||
|
||||
if (!sDataBundle) {
|
||||
nsresult rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &sDataBundle);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return GetBundleValue(sDataBundle, aCharset, nsDependentString(aProp), aResult);
|
||||
}
|
||||
|
||||
//static
|
||||
bool nsCharsetConverterManager::IsInternal(const nsACString& aCharset)
|
||||
{
|
||||
nsAutoString str;
|
||||
// fully qualify to possibly avoid vtable call
|
||||
nsresult rv = GetCharsetDataImpl(PromiseFlatCString(aCharset).get(),
|
||||
MOZ_UTF16(".isInternal"),
|
||||
str);
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//----------------------------------------------------------------------------
|
||||
// Interface nsICharsetConverterManager [implementation]
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetUnicodeEncoder(const char * aDest,
|
||||
nsIUnicodeEncoder ** aResult)
|
||||
{
|
||||
// resolve the charset first
|
||||
nsAutoCString charset;
|
||||
|
||||
// fully qualify to possibly avoid vtable call
|
||||
nsCharsetConverterManager::GetCharsetAlias(aDest, charset);
|
||||
|
||||
return nsCharsetConverterManager::GetUnicodeEncoderRaw(charset.get(),
|
||||
aResult);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetUnicodeEncoderRaw(const char * aDest,
|
||||
nsIUnicodeEncoder ** aResult)
|
||||
{
|
||||
*aResult= nullptr;
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoCString
|
||||
contractid(NS_LITERAL_CSTRING(NS_UNICODEENCODER_CONTRACTID_BASE) +
|
||||
nsDependentCString(aDest));
|
||||
|
||||
// Always create an instance since encoders hold state.
|
||||
encoder = do_CreateInstance(contractid.get(), &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
rv = NS_ERROR_UCONV_NOCONV;
|
||||
else
|
||||
{
|
||||
*aResult = encoder.get();
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetUnicodeDecoder(const char * aSrc,
|
||||
nsIUnicodeDecoder ** aResult)
|
||||
{
|
||||
// resolve the charset first
|
||||
nsAutoCString charset;
|
||||
|
||||
// fully qualify to possibly avoid vtable call
|
||||
if (NS_FAILED(nsCharsetConverterManager::GetCharsetAlias(aSrc, charset)))
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
|
||||
return nsCharsetConverterManager::GetUnicodeDecoderRaw(charset.get(),
|
||||
aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetUnicodeDecoderInternal(const char * aSrc,
|
||||
nsIUnicodeDecoder ** aResult)
|
||||
{
|
||||
// resolve the charset first
|
||||
nsAutoCString charset;
|
||||
|
||||
nsresult rv = nsCharsetAlias::GetPreferredInternal(nsDependentCString(aSrc),
|
||||
charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return nsCharsetConverterManager::GetUnicodeDecoderRaw(charset.get(),
|
||||
aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetUnicodeDecoderRaw(const char * aSrc,
|
||||
nsIUnicodeDecoder ** aResult)
|
||||
{
|
||||
*aResult= nullptr;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(contractbase, NS_UNICODEDECODER_CONTRACTID_BASE);
|
||||
nsDependentCString src(aSrc);
|
||||
|
||||
decoder = do_CreateInstance(PromiseFlatCString(contractbase + src).get(),
|
||||
&rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_UCONV_NOCONV);
|
||||
|
||||
decoder.forget(aResult);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static
|
||||
nsresult GetList(const nsACString& aCategory,
|
||||
const nsACString& aPrefix,
|
||||
nsIUTF8StringEnumerator** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = nullptr;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsTArray<nsCString>* array = new nsTArray<nsCString>;
|
||||
if (!array)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
catman->EnumerateCategory(PromiseFlatCString(aCategory).get(),
|
||||
getter_AddRefs(enumerator));
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
if (NS_FAILED(enumerator->GetNext(getter_AddRefs(supports))))
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsISupportsCString> supStr = do_QueryInterface(supports);
|
||||
if (!supStr)
|
||||
continue;
|
||||
|
||||
nsAutoCString name;
|
||||
if (NS_FAILED(supStr->GetData(name)))
|
||||
continue;
|
||||
|
||||
nsAutoCString fullName(aPrefix);
|
||||
fullName.Append(name);
|
||||
NS_ENSURE_TRUE(array->AppendElement(fullName), NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
return NS_NewAdoptingUTF8StringEnumerator(aResult, array);
|
||||
}
|
||||
|
||||
// we should change the interface so that we can just pass back a enumerator!
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetDecoderList(nsIUTF8StringEnumerator ** aResult)
|
||||
{
|
||||
return GetList(NS_LITERAL_CSTRING(NS_UNICODEDECODER_NAME),
|
||||
EmptyCString(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetEncoderList(nsIUTF8StringEnumerator ** aResult)
|
||||
{
|
||||
return GetList(NS_LITERAL_CSTRING(NS_UNICODEENCODER_NAME),
|
||||
EmptyCString(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetDetectorList(nsIUTF8StringEnumerator** aResult)
|
||||
{
|
||||
return GetList(NS_LITERAL_CSTRING("charset-detectors"),
|
||||
NS_LITERAL_CSTRING("chardet."), aResult);
|
||||
}
|
||||
|
||||
// XXX Improve the implementation of this method. Right now, it is build on
|
||||
// top of the nsCharsetAlias service. We can make the nsCharsetAlias
|
||||
// better, with its own hash table (not the StringBundle anymore) and
|
||||
// a nicer file format.
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetAlias(const char * aCharset,
|
||||
nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharset);
|
||||
|
||||
// We try to obtain the preferred name for this charset from the charset
|
||||
// aliases.
|
||||
nsresult rv;
|
||||
|
||||
rv = nsCharsetAlias::GetPreferred(nsDependentCString(aCharset), aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetTitle(const char * aCharset,
|
||||
nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharset);
|
||||
|
||||
if (!sTitleBundle) {
|
||||
nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &sTitleBundle);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return GetBundleValue(sTitleBundle, aCharset, NS_LITERAL_STRING(".title"), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetData(const char * aCharset,
|
||||
const char16_t * aProp,
|
||||
nsAString& aResult)
|
||||
{
|
||||
return GetCharsetDataImpl(aCharset, aProp, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetLangGroup(const char * aCharset,
|
||||
nsIAtom** aResult)
|
||||
{
|
||||
// resolve the charset first
|
||||
nsAutoCString charset;
|
||||
|
||||
nsresult rv = GetCharsetAlias(aCharset, charset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// fully qualify to possibly avoid vtable call
|
||||
return nsCharsetConverterManager::GetCharsetLangGroupRaw(charset.get(),
|
||||
aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCharsetConverterManager::GetCharsetLangGroupRaw(const char * aCharset,
|
||||
nsIAtom** aResult)
|
||||
{
|
||||
|
||||
*aResult = nullptr;
|
||||
nsAutoString langGroup;
|
||||
// fully qualify to possibly avoid vtable call
|
||||
nsresult rv = nsCharsetConverterManager::GetCharsetData(
|
||||
aCharset, MOZ_UTF16(".LangGroup"), langGroup);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
ToLowerCase(langGroup); // use lowercase for all language atoms
|
||||
*aResult = NS_NewAtom(langGroup).take();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user