зеркало из https://github.com/mozilla/gecko-dev.git
Merge Places and mozilla-central
This commit is contained in:
Коммит
648e8e3edc
|
@ -6892,7 +6892,7 @@ var gPluginHandler = {
|
|||
"npapi-carbon-event-model-failure" : {
|
||||
barID : "carbon-failure-plugins",
|
||||
iconURL : "chrome://mozapps/skin/plugins/notifyPluginGeneric.png",
|
||||
message : gNavigatorBundle.getString("carbonFailurePluginsMessage.title"),
|
||||
message : gNavigatorBundle.getString("carbonFailurePluginsMessage.message"),
|
||||
buttons: [{
|
||||
label : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.label"),
|
||||
accessKey : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.accesskey"),
|
||||
|
|
|
@ -187,7 +187,7 @@ libs-%:
|
|||
@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
|
||||
@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
|
||||
@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
|
||||
@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref BOTH_MANIFESTS=1
|
||||
@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) BOTH_MANIFESTS=1
|
||||
@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
|
||||
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ can reach it easily. -->
|
|||
- approximation to it or choose a word (or words) that means
|
||||
- "simple discardable text editor". -->
|
||||
<!ENTITY scratchpad.label "Scratchpad">
|
||||
<!ENTITY scratchpad.accesskey "r">
|
||||
<!ENTITY scratchpad.accesskey "s">
|
||||
<!ENTITY scratchpad.keycode "VK_F4">
|
||||
<!ENTITY scratchpad.keytext "F4">
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ crashedpluginsMessage.reloadButton.accesskey=R
|
|||
crashedpluginsMessage.submitButton.label=Submit a crash report
|
||||
crashedpluginsMessage.submitButton.accesskey=S
|
||||
crashedpluginsMessage.learnMore=Learn More…
|
||||
carbonFailurePluginsMessage.title=This page requires a plugin that can only run in 32-bit mode
|
||||
carbonFailurePluginsMessage.message=This page asks to use a plugin that can only run in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.label=Restart in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.accesskey=R
|
||||
|
||||
|
|
|
@ -934,6 +934,10 @@ class DeviceManager:
|
|||
return 'org.mozilla.fennec'
|
||||
elif (self.dirExists('/data/data/org.mozilla.firefox')):
|
||||
return 'org.mozilla.firefox'
|
||||
elif (self.dirExists('/data/data/org.mozilla.fennec_aurora')):
|
||||
return 'org.mozilla.fennec_aurora'
|
||||
elif (self.dirExists('/data/data/org.mozilla.firefox_beta')):
|
||||
return 'org.mozilla.firefox_beta'
|
||||
|
||||
# Failure (either not installed or not a recognized platform)
|
||||
return None
|
||||
|
|
|
@ -46,6 +46,7 @@ interface nsIURI;
|
|||
interface nsIVariant;
|
||||
interface nsPIDOMWindow;
|
||||
interface nsIInputStream;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
%{C++
|
||||
// for jsval
|
||||
|
@ -109,7 +110,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
|
|||
* you're aware of all the security implications. And then think twice about
|
||||
* it.
|
||||
*/
|
||||
[scriptable, uuid(af62a870-820c-4981-96a3-28ab17b779e1)]
|
||||
[scriptable, uuid(a05a6424-a644-461a-a1ff-c7bbe96ea9e2)]
|
||||
interface nsIXMLHttpRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -141,11 +142,20 @@ interface nsIXMLHttpRequest : nsISupports
|
|||
readonly attribute AString responseText;
|
||||
|
||||
/**
|
||||
* The response to the request as a typed array ArrayBuffer.
|
||||
* Determine a response format which response attribute returns.
|
||||
* empty string (initial value) or "text": as text.
|
||||
* "arraybuffer": as a typed array ArrayBuffer.
|
||||
* "blob": as a File API Blob.
|
||||
* "document": as a DOM Document object.
|
||||
*/
|
||||
attribute AString mozResponseType;
|
||||
|
||||
/**
|
||||
* The response to the request as a specified format by responseType.
|
||||
* NULL if the request is unsuccessful or
|
||||
* has not yet been sent.
|
||||
*/
|
||||
readonly attribute jsval /*ArrayBuffer*/ mozResponseArrayBuffer;
|
||||
[implicit_jscontext] readonly attribute jsval /* any */ mozResponse;
|
||||
|
||||
/**
|
||||
* The status of the response to the request for HTTP requests.
|
||||
|
@ -272,13 +282,19 @@ interface nsIXMLHttpRequest : nsISupports
|
|||
* The state of the request.
|
||||
*
|
||||
* Possible values:
|
||||
* 0 UNINITIALIZED open() has not been called yet.
|
||||
* 1 LOADING send() has not been called yet.
|
||||
* 2 LOADED send() has been called, headers and status are available.
|
||||
* 3 INTERACTIVE Downloading, responseText holds the partial data.
|
||||
* 4 COMPLETED Finished with all operations.
|
||||
* 0 UNSENT open() has not been called yet.
|
||||
* 1 OPENED send() has not been called yet.
|
||||
* 2 HEADERS_RECEIVED
|
||||
* send() has been called, headers and status are available.
|
||||
* 3 LOADING Downloading, responseText holds the partial data.
|
||||
* 4 DONE Finished with all operations.
|
||||
*/
|
||||
readonly attribute long readyState;
|
||||
const unsigned short UNSENT = 0;
|
||||
const unsigned short OPENED = 1;
|
||||
const unsigned short HEADERS_RECEIVED = 2;
|
||||
const unsigned short LOADING = 3;
|
||||
const unsigned short DONE = 4;
|
||||
readonly attribute unsigned short readyState;
|
||||
|
||||
/**
|
||||
* Override the mime type returned by the server (if any). This may
|
||||
|
|
|
@ -70,6 +70,8 @@ EXPORTS_mozilla/dom = \
|
|||
Link.h \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/js/src/xpconnect/src
|
||||
|
||||
CPPSRCS = \
|
||||
mozSanitizingSerializer.cpp \
|
||||
nsAtomListUtils.cpp \
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#include "nsIMIMEService.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsVariant.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsLoadListenerProxy.h"
|
||||
#include "nsStringStream.h"
|
||||
|
@ -100,6 +100,8 @@
|
|||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "nsStringBuffer.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFileChannel.h"
|
||||
|
||||
#define LOAD_STR "load"
|
||||
#define ERROR_STR "error"
|
||||
|
@ -113,13 +115,13 @@
|
|||
// CIDs
|
||||
|
||||
// State
|
||||
#define XML_HTTP_REQUEST_UNINITIALIZED (1 << 0) // 0
|
||||
#define XML_HTTP_REQUEST_OPENED (1 << 1) // 1 aka LOADING
|
||||
#define XML_HTTP_REQUEST_LOADED (1 << 2) // 2
|
||||
#define XML_HTTP_REQUEST_INTERACTIVE (1 << 3) // 3
|
||||
#define XML_HTTP_REQUEST_COMPLETED (1 << 4) // 4
|
||||
#define XML_HTTP_REQUEST_SENT (1 << 5) // Internal, LOADING in IE and external view
|
||||
#define XML_HTTP_REQUEST_STOPPED (1 << 6) // Internal, INTERACTIVE in IE and external view
|
||||
#define XML_HTTP_REQUEST_UNSENT (1 << 0) // 0 UNSENT
|
||||
#define XML_HTTP_REQUEST_OPENED (1 << 1) // 1 OPENED
|
||||
#define XML_HTTP_REQUEST_HEADERS_RECEIVED (1 << 2) // 2 HEADERS_RECEIVED
|
||||
#define XML_HTTP_REQUEST_LOADING (1 << 3) // 3 LOADING
|
||||
#define XML_HTTP_REQUEST_DONE (1 << 4) // 4 DONE
|
||||
#define XML_HTTP_REQUEST_SENT (1 << 5) // Internal, OPENED in IE and external view
|
||||
#define XML_HTTP_REQUEST_STOPPED (1 << 6) // Internal, LOADING in IE and external view
|
||||
// The above states are mutually exclusive, change with ChangeState() only.
|
||||
// The states below can be combined.
|
||||
#define XML_HTTP_REQUEST_ABORTED (1 << 7) // Internal
|
||||
|
@ -137,11 +139,11 @@
|
|||
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 17) // Internal
|
||||
|
||||
#define XML_HTTP_REQUEST_LOADSTATES \
|
||||
(XML_HTTP_REQUEST_UNINITIALIZED | \
|
||||
(XML_HTTP_REQUEST_UNSENT | \
|
||||
XML_HTTP_REQUEST_OPENED | \
|
||||
XML_HTTP_REQUEST_LOADED | \
|
||||
XML_HTTP_REQUEST_INTERACTIVE | \
|
||||
XML_HTTP_REQUEST_COMPLETED | \
|
||||
XML_HTTP_REQUEST_HEADERS_RECEIVED | \
|
||||
XML_HTTP_REQUEST_LOADING | \
|
||||
XML_HTTP_REQUEST_DONE | \
|
||||
XML_HTTP_REQUEST_SENT | \
|
||||
XML_HTTP_REQUEST_STOPPED)
|
||||
|
||||
|
@ -417,7 +419,8 @@ NS_IMPL_RELEASE_INHERITED(nsXMLHttpRequestUpload, nsXHREventTarget)
|
|||
/////////////////////////////////////////////
|
||||
|
||||
nsXMLHttpRequest::nsXMLHttpRequest()
|
||||
: mRequestObserver(nsnull), mState(XML_HTTP_REQUEST_UNINITIALIZED),
|
||||
: mResponseType(XML_HTTP_RESPONSE_TYPE_DEFAULT),
|
||||
mRequestObserver(nsnull), mState(XML_HTTP_REQUEST_UNSENT),
|
||||
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(PR_TRUE),
|
||||
mUploadProgress(0), mUploadProgressMax(0),
|
||||
mErrorLoad(PR_FALSE), mTimerIsActive(PR_FALSE),
|
||||
|
@ -437,7 +440,7 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
|
|||
|
||||
if (mState & (XML_HTTP_REQUEST_STOPPED |
|
||||
XML_HTTP_REQUEST_SENT |
|
||||
XML_HTTP_REQUEST_INTERACTIVE)) {
|
||||
XML_HTTP_REQUEST_LOADING)) {
|
||||
Abort();
|
||||
}
|
||||
|
||||
|
@ -661,7 +664,11 @@ nsXMLHttpRequest::GetResponseXML(nsIDOMDocument **aResponseXML)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResponseXML);
|
||||
*aResponseXML = nsnull;
|
||||
if ((XML_HTTP_REQUEST_COMPLETED & mState) && mResponseXML) {
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_DOCUMENT) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
if ((XML_HTTP_REQUEST_DONE & mState) && mResponseXML) {
|
||||
*aResponseXML = mResponseXML;
|
||||
NS_ADDREF(*aResponseXML);
|
||||
}
|
||||
|
@ -819,23 +826,27 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
|
|||
|
||||
aResponseText.Truncate();
|
||||
|
||||
if (mState & (XML_HTTP_REQUEST_COMPLETED |
|
||||
XML_HTTP_REQUEST_INTERACTIVE)) {
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_TEXT) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (mState & (XML_HTTP_REQUEST_DONE |
|
||||
XML_HTTP_REQUEST_LOADING)) {
|
||||
rv = ConvertBodyToText(aResponseText);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* readonly attribute jsval (ArrayBuffer) mozResponseArrayBuffer; */
|
||||
NS_IMETHODIMP nsXMLHttpRequest::GetMozResponseArrayBuffer(jsval *aResult)
|
||||
nsresult nsXMLHttpRequest::GetResponseArrayBuffer(jsval *aResult)
|
||||
{
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (!cx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!(mState & (XML_HTTP_REQUEST_COMPLETED |
|
||||
XML_HTTP_REQUEST_INTERACTIVE))) {
|
||||
if (!(mState & (XML_HTTP_REQUEST_DONE |
|
||||
XML_HTTP_REQUEST_LOADING))) {
|
||||
*aResult = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -856,6 +867,126 @@ NS_IMETHODIMP nsXMLHttpRequest::GetMozResponseArrayBuffer(jsval *aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString responseType; */
|
||||
NS_IMETHODIMP nsXMLHttpRequest::GetMozResponseType(nsAString& aResponseType)
|
||||
{
|
||||
switch (mResponseType) {
|
||||
case XML_HTTP_RESPONSE_TYPE_DEFAULT:
|
||||
aResponseType.Truncate();
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER:
|
||||
aResponseType.AssignLiteral("arraybuffer");
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_BLOB:
|
||||
aResponseType.AssignLiteral("blob");
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_DOCUMENT:
|
||||
aResponseType.AssignLiteral("document");
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_TEXT:
|
||||
aResponseType.AssignLiteral("text");
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Should not happen");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString responseType; */
|
||||
NS_IMETHODIMP nsXMLHttpRequest::SetMozResponseType(const nsAString& aResponseType)
|
||||
{
|
||||
// If the state is not OPENED or HEADERS_RECEIVED raise an
|
||||
// INVALID_STATE_ERR exception and terminate these steps.
|
||||
if (!(mState & (XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT |
|
||||
XML_HTTP_REQUEST_HEADERS_RECEIVED)))
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
|
||||
// Set the responseType attribute's value to the given value.
|
||||
if (aResponseType.IsEmpty()) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_DEFAULT;
|
||||
} else if (aResponseType.EqualsLiteral("arraybuffer")) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER;
|
||||
} else if (aResponseType.EqualsLiteral("blob")) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_BLOB;
|
||||
} else if (aResponseType.EqualsLiteral("document")) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_DOCUMENT;
|
||||
} else if (aResponseType.EqualsLiteral("text")) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_TEXT;
|
||||
}
|
||||
// If the given value is not the empty string, "arraybuffer",
|
||||
// "blob", "document", or "text" terminate these steps.
|
||||
|
||||
// If the state is OPENED, SetCacheAsFile would have no effect here
|
||||
// because the channel hasn't initialized the cache entry yet.
|
||||
// SetCacheAsFile will be called from OnStartRequest.
|
||||
// If the state is HEADERS_RECEIVED, however, we need to call
|
||||
// it immediately because OnStartRequest is already dispatched.
|
||||
if (mState & XML_HTTP_REQUEST_HEADERS_RECEIVED) {
|
||||
nsCOMPtr<nsICachingChannel> cc(do_QueryInterface(mChannel));
|
||||
if (cc) {
|
||||
cc->SetCacheAsFile(mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute jsval response; */
|
||||
NS_IMETHODIMP nsXMLHttpRequest::GetMozResponse(JSContext *aCx, jsval *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
switch (mResponseType) {
|
||||
case XML_HTTP_RESPONSE_TYPE_DEFAULT:
|
||||
case XML_HTTP_RESPONSE_TYPE_TEXT:
|
||||
{
|
||||
nsString str;
|
||||
rv = GetResponseText(str);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsStringBuffer* buf;
|
||||
*aResult = XPCStringConvert::ReadableToJSVal(aCx, str, &buf);
|
||||
if (buf) {
|
||||
str.ForgetSharedBuffer();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER:
|
||||
if (mState & XML_HTTP_REQUEST_DONE) {
|
||||
rv = GetResponseArrayBuffer(aResult);
|
||||
} else {
|
||||
*aResult = JSVAL_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_HTTP_RESPONSE_TYPE_BLOB:
|
||||
if (mState & XML_HTTP_REQUEST_DONE && mResponseBlob) {
|
||||
JSObject* scope = JS_GetScopeChain(aCx);
|
||||
rv = nsContentUtils::WrapNative(aCx, scope, mResponseBlob, aResult,
|
||||
nsnull, PR_TRUE);
|
||||
} else {
|
||||
*aResult = JSVAL_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_HTTP_RESPONSE_TYPE_DOCUMENT:
|
||||
if (mState & XML_HTTP_REQUEST_DONE && mResponseXML) {
|
||||
JSObject* scope = JS_GetScopeChain(aCx);
|
||||
rv = nsContentUtils::WrapNative(aCx, scope, mResponseXML, aResult,
|
||||
nsnull, PR_TRUE);
|
||||
} else {
|
||||
*aResult = JSVAL_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ERROR("Should not happen");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long status; */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetStatus(PRUint32 *aStatus)
|
||||
|
@ -882,9 +1013,9 @@ nsXMLHttpRequest::GetStatus(PRUint32 *aStatus)
|
|||
// Someone's calling this before we got a response... Check our
|
||||
// ReadyState. If we're at 3 or 4, then this means the connection
|
||||
// errored before we got any data; return 0 in that case.
|
||||
PRInt32 readyState;
|
||||
PRUint16 readyState;
|
||||
GetReadyState(&readyState);
|
||||
if (readyState >= 3) {
|
||||
if (readyState >= LOADING) {
|
||||
*aStatus = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -940,12 +1071,13 @@ nsXMLHttpRequest::Abort()
|
|||
PRUint32 responseLength = mResponseBody.Length();
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
mState |= XML_HTTP_REQUEST_ABORTED;
|
||||
|
||||
if (!(mState & (XML_HTTP_REQUEST_UNINITIALIZED |
|
||||
if (!(mState & (XML_HTTP_REQUEST_UNSENT |
|
||||
XML_HTTP_REQUEST_OPENED |
|
||||
XML_HTTP_REQUEST_COMPLETED))) {
|
||||
ChangeState(XML_HTTP_REQUEST_COMPLETED, PR_TRUE);
|
||||
XML_HTTP_REQUEST_DONE))) {
|
||||
ChangeState(XML_HTTP_REQUEST_DONE, PR_TRUE);
|
||||
}
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_SYNCLOOPING)) {
|
||||
|
@ -963,7 +1095,7 @@ nsXMLHttpRequest::Abort()
|
|||
// if they load a new url will cause nsXMLHttpRequest::Open to clear
|
||||
// the abort state bit. If this occurs we're not uninitialized (bug 361773).
|
||||
if (mState & XML_HTTP_REQUEST_ABORTED) {
|
||||
ChangeState(XML_HTTP_REQUEST_UNINITIALIZED, PR_FALSE); // IE seems to do it
|
||||
ChangeState(XML_HTTP_REQUEST_UNSENT, PR_FALSE); // IE seems to do it
|
||||
}
|
||||
|
||||
mState &= ~XML_HTTP_REQUEST_SYNCLOOPING;
|
||||
|
@ -1263,8 +1395,8 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
|
|||
PRBool authp = PR_FALSE;
|
||||
|
||||
if (mState & (XML_HTTP_REQUEST_OPENED |
|
||||
XML_HTTP_REQUEST_LOADED |
|
||||
XML_HTTP_REQUEST_INTERACTIVE |
|
||||
XML_HTTP_REQUEST_HEADERS_RECEIVED |
|
||||
XML_HTTP_REQUEST_LOADING |
|
||||
XML_HTTP_REQUEST_SENT |
|
||||
XML_HTTP_REQUEST_STOPPED)) {
|
||||
// IE aborts as well
|
||||
|
@ -1395,9 +1527,22 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB &&
|
||||
xmlHttpRequest->mResponseBlob) {
|
||||
xmlHttpRequest->ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
*writeCount = count;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (xmlHttpRequest->mResponseType != XML_HTTP_RESPONSE_TYPE_DOCUMENT) {
|
||||
// Copy for our own use
|
||||
PRUint32 previousLength = xmlHttpRequest->mResponseBody.Length();
|
||||
xmlHttpRequest->mResponseBody.Append(fromRawSegment,count);
|
||||
if (count > 0 && xmlHttpRequest->mResponseBody.Length() == previousLength) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
xmlHttpRequest->mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -1425,7 +1570,7 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
|
|||
}
|
||||
}
|
||||
|
||||
xmlHttpRequest->ChangeState(XML_HTTP_REQUEST_INTERACTIVE);
|
||||
xmlHttpRequest->ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*writeCount = count;
|
||||
|
@ -1436,6 +1581,35 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
|
|||
return rv;
|
||||
}
|
||||
|
||||
void nsXMLHttpRequest::CreateResponseBlob(nsIRequest *request)
|
||||
{
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsCOMPtr<nsICachingChannel> cc(do_QueryInterface(request));
|
||||
if (cc) {
|
||||
cc->GetCacheFile(getter_AddRefs(file));
|
||||
if (!file) {
|
||||
// cacheAsFile returns false if caching is inhibited
|
||||
PRBool cacheAsFile = PR_FALSE;
|
||||
if (NS_SUCCEEDED(cc->GetCacheAsFile(&cacheAsFile)) && cacheAsFile) {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIFileChannel> fc = do_QueryInterface(request);
|
||||
if (fc) {
|
||||
fc->GetFile(getter_AddRefs(file));
|
||||
}
|
||||
}
|
||||
if (file) {
|
||||
nsCAutoString contentType;
|
||||
mChannel->GetContentType(contentType);
|
||||
mResponseBlob = new nsDOMFile(file,
|
||||
NS_ConvertASCIItoUTF16(contentType));
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
|
@ -1444,6 +1618,10 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInp
|
|||
|
||||
NS_ABORT_IF_FALSE(mContext.get() == ctxt,"start context different from OnDataAvailable context");
|
||||
|
||||
if (mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB && !mResponseBlob) {
|
||||
CreateResponseBlob(request);
|
||||
}
|
||||
|
||||
PRUint32 totalRead;
|
||||
return inStr->ReadSegments(nsXMLHttpRequest::StreamReaderFunc, (void*)this, count, &totalRead);
|
||||
}
|
||||
|
@ -1478,7 +1656,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
}
|
||||
|
||||
// Don't do anything if we have been aborted
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED)
|
||||
if (mState & XML_HTTP_REQUEST_UNSENT)
|
||||
return NS_OK;
|
||||
|
||||
if (mState & XML_HTTP_REQUEST_ABORTED) {
|
||||
|
@ -1509,7 +1687,14 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
mContext = ctxt;
|
||||
mState |= XML_HTTP_REQUEST_PARSEBODY;
|
||||
mState &= ~XML_HTTP_REQUEST_MPART_HEADERS;
|
||||
ChangeState(XML_HTTP_REQUEST_LOADED);
|
||||
ChangeState(XML_HTTP_REQUEST_HEADERS_RECEIVED);
|
||||
|
||||
if (mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB) {
|
||||
nsCOMPtr<nsICachingChannel> cc(do_QueryInterface(mChannel));
|
||||
if (cc) {
|
||||
cc->SetCacheAsFile(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult status;
|
||||
request->GetStatus(&status);
|
||||
|
@ -1525,11 +1710,13 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
// Reset responseBody
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
|
||||
// Set up responseXML
|
||||
PRBool parseBody = PR_TRUE;
|
||||
PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
|
||||
mResponseType == XML_HTTP_RESPONSE_TYPE_DOCUMENT;
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
|
||||
if (httpChannel) {
|
||||
if (parseBody && httpChannel) {
|
||||
nsCAutoString method;
|
||||
httpChannel->GetRequestMethod(method);
|
||||
parseBody = !method.EqualsLiteral("HEAD");
|
||||
|
@ -1668,7 +1855,7 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
|||
|
||||
// make sure to notify the listener if we were aborted
|
||||
// XXX in fact, why don't we do the cleanup below in this case??
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED) {
|
||||
if (mState & XML_HTTP_REQUEST_UNSENT) {
|
||||
if (mXMLParserStreamListener)
|
||||
(void) mXMLParserStreamListener->OnStopRequest(request, ctxt, status);
|
||||
return NS_OK;
|
||||
|
@ -1690,6 +1877,31 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
|||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
NS_ENSURE_TRUE(channel, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (NS_SUCCEEDED(status) && mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB) {
|
||||
if (!mResponseBlob) {
|
||||
CreateResponseBlob(request);
|
||||
}
|
||||
if (!mResponseBlob) {
|
||||
// Smaller files may be written in cache map instead of separate files.
|
||||
// Also, no-store response cannot be written in persistent cache.
|
||||
nsCAutoString contentType;
|
||||
mChannel->GetContentType(contentType);
|
||||
// XXX We should change mResponseBody to be a raw malloc'ed buffer
|
||||
// to avoid copying the data.
|
||||
PRUint32 blobLen = mResponseBody.Length();
|
||||
void *blobData = PR_Malloc(blobLen);
|
||||
if (blobData) {
|
||||
memcpy(blobData, mResponseBody.BeginReading(), blobLen);
|
||||
mResponseBlob =
|
||||
new nsDOMMemoryFile(blobData, blobLen, EmptyString(),
|
||||
NS_ConvertASCIItoUTF16(contentType));
|
||||
mResponseBody.Truncate();
|
||||
}
|
||||
NS_ASSERTION(mResponseBodyUnicode.IsVoid(),
|
||||
"mResponseBodyUnicode should be empty");
|
||||
}
|
||||
}
|
||||
|
||||
channel->SetNotificationCallbacks(nsnull);
|
||||
mNotificationCallbacks = nsnull;
|
||||
mChannelEventSink = nsnull;
|
||||
|
@ -1736,8 +1948,8 @@ nsXMLHttpRequest::RequestCompleted()
|
|||
// If we're uninitialized at this point, we encountered an error
|
||||
// earlier and listeners have already been notified. Also we do
|
||||
// not want to do this if we already completed.
|
||||
if (mState & (XML_HTTP_REQUEST_UNINITIALIZED |
|
||||
XML_HTTP_REQUEST_COMPLETED)) {
|
||||
if (mState & (XML_HTTP_REQUEST_UNSENT |
|
||||
XML_HTTP_REQUEST_DONE)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1753,7 +1965,7 @@ nsXMLHttpRequest::RequestCompleted()
|
|||
}
|
||||
}
|
||||
|
||||
ChangeState(XML_HTTP_REQUEST_COMPLETED, PR_TRUE);
|
||||
ChangeState(XML_HTTP_REQUEST_DONE, PR_TRUE);
|
||||
|
||||
PRUint32 responseLength = mResponseBody.Length();
|
||||
NS_NAMED_LITERAL_STRING(errorStr, ERROR_STR);
|
||||
|
@ -2134,6 +2346,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
|||
// Reset responseBody
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
|
||||
// Reset responseXML
|
||||
mResponseXML = nsnull;
|
||||
|
@ -2369,20 +2582,20 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
|
||||
/* readonly attribute long readyState; */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetReadyState(PRInt32 *aState)
|
||||
nsXMLHttpRequest::GetReadyState(PRUint16 *aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
// Translate some of our internal states for external consumers
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED) {
|
||||
*aState = 0; // UNINITIALIZED
|
||||
if (mState & XML_HTTP_REQUEST_UNSENT) {
|
||||
*aState = UNSENT;
|
||||
} else if (mState & (XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT)) {
|
||||
*aState = 1; // LOADING
|
||||
} else if (mState & XML_HTTP_REQUEST_LOADED) {
|
||||
*aState = 2; // LOADED
|
||||
} else if (mState & (XML_HTTP_REQUEST_INTERACTIVE | XML_HTTP_REQUEST_STOPPED)) {
|
||||
*aState = 3; // INTERACTIVE
|
||||
} else if (mState & XML_HTTP_REQUEST_COMPLETED) {
|
||||
*aState = 4; // COMPLETED
|
||||
*aState = OPENED;
|
||||
} else if (mState & XML_HTTP_REQUEST_HEADERS_RECEIVED) {
|
||||
*aState = HEADERS_RECEIVED;
|
||||
} else if (mState & (XML_HTTP_REQUEST_LOADING | XML_HTTP_REQUEST_STOPPED)) {
|
||||
*aState = LOADING;
|
||||
} else if (mState & XML_HTTP_REQUEST_DONE) {
|
||||
*aState = DONE;
|
||||
} else {
|
||||
NS_ERROR("Should not happen");
|
||||
}
|
||||
|
@ -2413,7 +2626,7 @@ nsXMLHttpRequest::GetMultipart(PRBool *_retval)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetMultipart(PRBool aMultipart)
|
||||
{
|
||||
if (!(mState & XML_HTTP_REQUEST_UNINITIALIZED)) {
|
||||
if (!(mState & XML_HTTP_REQUEST_UNSENT)) {
|
||||
// Can't change this while we're in the middle of something.
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
}
|
||||
|
@ -2448,7 +2661,7 @@ nsXMLHttpRequest::SetMozBackgroundRequest(PRBool aMozBackgroundRequest)
|
|||
if (!privileged)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_UNINITIALIZED)) {
|
||||
if (!(mState & XML_HTTP_REQUEST_UNSENT)) {
|
||||
// Can't change this while we're in the middle of something.
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
}
|
||||
|
@ -2545,7 +2758,7 @@ nsresult
|
|||
nsXMLHttpRequest::Error(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mResponseXML = nsnull;
|
||||
ChangeState(XML_HTTP_REQUEST_COMPLETED);
|
||||
ChangeState(XML_HTTP_REQUEST_DONE);
|
||||
|
||||
mState &= ~XML_HTTP_REQUEST_SYNCLOOPING;
|
||||
|
||||
|
@ -2572,7 +2785,7 @@ nsXMLHttpRequest::ChangeState(PRUint32 aState, PRBool aBroadcast)
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
if (mProgressNotifier &&
|
||||
!(aState & (XML_HTTP_REQUEST_LOADED | XML_HTTP_REQUEST_INTERACTIVE))) {
|
||||
!(aState & (XML_HTTP_REQUEST_HEADERS_RECEIVED | XML_HTTP_REQUEST_LOADING))) {
|
||||
mTimerIsActive = PR_FALSE;
|
||||
mProgressNotifier->Cancel();
|
||||
}
|
||||
|
@ -2581,7 +2794,7 @@ nsXMLHttpRequest::ChangeState(PRUint32 aState, PRBool aBroadcast)
|
|||
aBroadcast &&
|
||||
(mState & XML_HTTP_REQUEST_ASYNC ||
|
||||
aState & XML_HTTP_REQUEST_OPENED ||
|
||||
aState & XML_HTTP_REQUEST_COMPLETED)) {
|
||||
aState & XML_HTTP_REQUEST_DONE)) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
rv = CreateReadystatechangeEvent(getter_AddRefs(event));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -224,6 +224,8 @@ protected:
|
|||
PRUint32 toOffset,
|
||||
PRUint32 count,
|
||||
PRUint32 *writeCount);
|
||||
nsresult GetResponseArrayBuffer(jsval *aResult);
|
||||
void CreateResponseBlob(nsIRequest *request);
|
||||
// Change the state of the object with this. The broadcast argument
|
||||
// determines if the onreadystatechange listener should be called.
|
||||
nsresult ChangeState(PRUint32 aState, PRBool aBroadcast = PR_TRUE);
|
||||
|
@ -293,6 +295,16 @@ protected:
|
|||
// will cause us to clear the cached value anyway.
|
||||
nsString mResponseBodyUnicode;
|
||||
|
||||
enum {
|
||||
XML_HTTP_RESPONSE_TYPE_DEFAULT,
|
||||
XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER,
|
||||
XML_HTTP_RESPONSE_TYPE_BLOB,
|
||||
XML_HTTP_RESPONSE_TYPE_DOCUMENT,
|
||||
XML_HTTP_RESPONSE_TYPE_TEXT
|
||||
} mResponseType;
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> mResponseBlob;
|
||||
|
||||
nsCString mOverrideMimeType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var path = "/tests/content/base/test/";
|
||||
|
||||
|
@ -28,16 +29,19 @@ var failFiles = [['//example.com' + path + 'file_XHR_pass1.xml', 'GET'],
|
|||
|
||||
for (i = 0; i < passFiles.length; ++i) {
|
||||
xhr = new XMLHttpRequest();
|
||||
is(xhr.mozResponseType, "", "wrong initial responseType");
|
||||
xhr.open(passFiles[i][1], passFiles[i][0], false);
|
||||
xhr.send(null);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
if (xhr.responseXML) {
|
||||
is((new XMLSerializer()).serializeToString(xhr.responseXML.documentElement),
|
||||
"<res>hello</res>",
|
||||
"wrong response");
|
||||
"wrong responseXML");
|
||||
is(xhr.mozResponse, "<res>hello</res>\n", "wrong response");
|
||||
}
|
||||
else {
|
||||
is(xhr.responseText, "hello pass\n", "wrong response");
|
||||
is(xhr.responseText, "hello pass\n", "wrong responseText");
|
||||
is(xhr.mozResponse, "hello pass\n", "wrong response");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,35 +64,127 @@ for (i = 0; i < failFiles.length; ++i) {
|
|||
}
|
||||
}
|
||||
|
||||
// test mozResponseArrayBuffer
|
||||
// test response (responseType='document')
|
||||
function checkResponseTextAccessThrows(xhr) {
|
||||
var didthrow = false;
|
||||
try { xhr.responseText } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing responseText");
|
||||
}
|
||||
function checkResponseXMLAccessThrows(xhr) {
|
||||
var didthrow = false;
|
||||
try { xhr.responseXML } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing responseXML");
|
||||
}
|
||||
function checkSetResponseTypeThrows(xhr) {
|
||||
var didthrow = false;
|
||||
try { xhr.mozResponseType = 'document'; } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing responseType");
|
||||
}
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
checkSetResponseTypeThrows(xhr);
|
||||
xhr.open("GET", 'file_XHR_pass1.xml', false);
|
||||
xhr.mozResponseType = 'document';
|
||||
xhr.send(null);
|
||||
checkSetResponseTypeThrows(xhr);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
is((new XMLSerializer()).serializeToString(xhr.mozResponse.documentElement),
|
||||
"<res>hello</res>",
|
||||
"wrong response");
|
||||
|
||||
// test response (responseType='text')
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", 'file_XHR_pass2.txt', false);
|
||||
xhr.mozResponseType = 'text';
|
||||
xhr.send(null);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
is(xhr.mozResponse, "hello pass\n", "wrong response");
|
||||
|
||||
// test response (responseType='arraybuffer')
|
||||
function arraybuffer_equals_to(ab, s) {
|
||||
is(ab.byteLength, s.length, "wrong arraybuffer byteLength");
|
||||
|
||||
u8v = new Uint8Array(ab);
|
||||
is(String.fromCharCode.apply(String, u8v), s, "wrong values");
|
||||
}
|
||||
|
||||
// with a simple text file
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", 'file_XHR_pass2.txt', false);
|
||||
xhr.mozResponseType = 'arraybuffer';
|
||||
xhr.send(null);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
ab = xhr.mozResponseArrayBuffer;
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
ab = xhr.mozResponse;
|
||||
ok(ab != null, "should have a non-null arraybuffer");
|
||||
is(ab.byteLength, "hello pass\n".length, "wrong arraybuffer byteLength");
|
||||
|
||||
u8v = new Uint8Array(ab);
|
||||
ok(String.fromCharCode([u8v[0], u8v[1], u8v[2], u8v[3], u8v[4]]), "hello", "wrong values");
|
||||
arraybuffer_equals_to(ab, "hello pass\n");
|
||||
|
||||
// with a binary file
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", 'file_XHR_binary1.bin', false);
|
||||
xhr.mozResponseType = 'arraybuffer';
|
||||
xhr.send(null)
|
||||
is(xhr.status, 200, "wrong status");
|
||||
ab = xhr.mozResponseArrayBuffer;
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
ab = xhr.mozResponse;
|
||||
ok(ab != null, "should have a non-null arraybuffer");
|
||||
is(ab.byteLength, 12, "wrong arraybuffer byteLength");
|
||||
arraybuffer_equals_to(ab, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
|
||||
|
||||
u8v = new Uint8Array(ab);
|
||||
i32v = new Int32Array(ab);
|
||||
u32v = new Uint32Array(ab, 8);
|
||||
ok(u8v[0] == 0xaa && u8v[1] == 0xee && u8v[2] == 0x00 && u8v[3] == 0x03, "wrong initial 4 bytes");
|
||||
is(i32v[1], -1, "wrong value, expected -1 (0xffffffff)");
|
||||
is(u32v[0], 0xbbbbbbbb, "wrong value, expected 0xbbbbbbbb");
|
||||
// test response (responseType='blob')
|
||||
var onloadCount = 0;
|
||||
function checkOnloadCount() {
|
||||
if (++onloadCount >= 2) SimpleTest.finish();
|
||||
};
|
||||
|
||||
// with a simple text file
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", 'file_XHR_pass2.txt', false);
|
||||
xhr.mozResponseType = 'blob';
|
||||
xhr.send(null);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
b = xhr.mozResponse;
|
||||
ok(b, "should have a non-null blob");
|
||||
is(b.size, "hello pass\n".length, "wrong blob size");
|
||||
|
||||
fr = new FileReader();
|
||||
fr.onload = function() {
|
||||
ok(fr.result, "hello pass\n", "wrong values");
|
||||
checkOnloadCount();
|
||||
};
|
||||
fr.readAsBinaryString(b);
|
||||
|
||||
// with a binary file
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
switch (xhr.readyState) {
|
||||
case 2:
|
||||
is(xhr.status, 200, "wrong status");
|
||||
xhr.mozResponseType = 'blob';
|
||||
break;
|
||||
case 4:
|
||||
b = xhr.mozResponse;
|
||||
ok(b != null, "should have a non-null blob");
|
||||
is(b.size, 12, "wrong blob size");
|
||||
|
||||
fr = new FileReader();
|
||||
fr.onload = function() {
|
||||
is(fr.result, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb", "wrong values");
|
||||
checkOnloadCount();
|
||||
};
|
||||
xhr = null; // kill the XHR object
|
||||
SpecialPowers.gc();
|
||||
fr.readAsBinaryString(b);
|
||||
break;
|
||||
}
|
||||
};
|
||||
xhr.open("GET", 'file_XHR_binary1.bin', true);
|
||||
xhr.send(null);
|
||||
|
||||
var client = new XMLHttpRequest();
|
||||
client.onreadystatechange = function() {
|
||||
|
@ -96,6 +192,7 @@ client.onreadystatechange = function() {
|
|||
try {
|
||||
is(client.responseXML, null, "responseXML should be null.");
|
||||
is(client.responseText, "", "responseText should be empty string.");
|
||||
is(client.mozResponse, "", "response should be empty string.");
|
||||
is(client.status, 0, "status should be 0.");
|
||||
is(client.statusText, "", "statusText should be empty string.");
|
||||
is(client.getAllResponseHeaders(), "",
|
||||
|
|
|
@ -144,4 +144,6 @@ nsresult
|
|||
NS_NewDOMMozTouchEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsMozTouchEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMCustomEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
#endif // nsIPrivateDOMEvent_h__
|
||||
|
|
|
@ -92,6 +92,7 @@ CPPSRCS = \
|
|||
nsDOMHashChangeEvent.cpp \
|
||||
nsDOMCloseEvent.cpp \
|
||||
nsDOMTouchEvent.cpp \
|
||||
nsDOMCustomEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_CSS_ANIMATIONS
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsDOMCustomEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMCustomEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDetail)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDetail)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
DOMCI_DATA(CustomEvent, nsDOMCustomEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCustomEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCustomEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CustomEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCustomEvent::GetDetail(nsIVariant** aDetail)
|
||||
{
|
||||
NS_IF_ADDREF(*aDetail = mDetail);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCustomEvent::InitCustomEvent(const nsAString& aType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
nsIVariant* aDetail)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDetail = aDetail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMCustomEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMCustomEvent* e = new nsDOMCustomEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(e, aInstancePtrResult);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsDOMCustomEvent_h__
|
||||
#define nsDOMCustomEvent_h__
|
||||
|
||||
#include "nsIDOMCustomEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsDOMCustomEvent : public nsDOMEvent,
|
||||
public nsIDOMCustomEvent
|
||||
{
|
||||
public:
|
||||
nsDOMCustomEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent)
|
||||
{
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
|
||||
NS_DECL_NSIDOMCUSTOMEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIVariant> mDetail;
|
||||
};
|
||||
|
||||
#endif // nsDOMCustomEvent_h__
|
|
@ -878,6 +878,8 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||
return NS_NewDOMTouchEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
|
||||
return NS_NewDOMHashChangeEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("customevent"))
|
||||
return NS_NewDOMCustomEvent(aDOMEvent, aPresContext, nsnull);
|
||||
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ _TEST_FILES = \
|
|||
test_bug409604.html \
|
||||
test_bug412567.html \
|
||||
test_bug426082.html \
|
||||
test_bug427537.html \
|
||||
test_bug443985.html \
|
||||
test_bug447736.html \
|
||||
test_bug450876.html \
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=427537
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 427537</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=427537">Mozilla Bug 427537</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 427537 **/
|
||||
|
||||
var e = document.createEvent("CustomEvent");
|
||||
ok(e, "Should have custom event!");
|
||||
|
||||
// Test initCustomEvent and also cycle collection handling by
|
||||
// passing reference to the event as 'detail' parameter.
|
||||
e.initCustomEvent("foobar", true, true, e);
|
||||
|
||||
var didCallListener = false;
|
||||
document.addEventListener("foobar",
|
||||
function(evt) {
|
||||
didCallListener = true;
|
||||
is(evt.type, "foobar", "Should get 'foobar' event!");
|
||||
is(evt.detail, evt, ".detail should point to the event itself.");
|
||||
ok(e.bubbles, "Event should bubble!");
|
||||
ok(e.cancelable, "Event should be cancelable.");
|
||||
}, true);
|
||||
|
||||
document.dispatchEvent(e);
|
||||
ok(didCallListener, "Should have called listener!");
|
||||
|
||||
e = document.createEvent("CustomEvent");
|
||||
e.initCustomEvent("foobar", true, true, 1);
|
||||
is(e.detail, 1, "Detail should be 1.");
|
||||
|
||||
e = document.createEvent("CustomEvent");
|
||||
e.initCustomEvent("foobar", true, true, "test");
|
||||
is(e.detail, "test", "Detail should be 'test'.");
|
||||
|
||||
e = document.createEvent("CustomEvent");
|
||||
e.initCustomEvent("foobar", true, true, true);
|
||||
is(e.detail, true, "Detail should be true.");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -58,6 +58,7 @@ enum FormControlsTypes {
|
|||
NS_FORM_SELECT,
|
||||
NS_FORM_TEXTAREA,
|
||||
NS_FORM_OBJECT,
|
||||
NS_FORM_PROGRESS,
|
||||
eFormControlsWithoutSubTypesMax,
|
||||
// After this, all types will have sub-types which introduce new enum lists.
|
||||
// eFormControlsWithoutSubTypesMax let us know if the previous types values
|
||||
|
@ -283,7 +284,7 @@ nsIFormControl::IsLabelableControl() const
|
|||
// type == NS_FORM_KEYGEN ||
|
||||
// type == NS_FORM_METER ||
|
||||
type == NS_FORM_OUTPUT ||
|
||||
// type == NS_FORM_PROGRESS ||
|
||||
type == NS_FORM_PROGRESS ||
|
||||
type == NS_FORM_SELECT ||
|
||||
type == NS_FORM_TEXTAREA;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ CPPSRCS = \
|
|||
nsHTMLOutputElement.cpp \
|
||||
nsHTMLParagraphElement.cpp \
|
||||
nsHTMLPreElement.cpp \
|
||||
nsHTMLProgressElement.cpp \
|
||||
nsHTMLScriptElement.cpp \
|
||||
nsHTMLSelectElement.cpp \
|
||||
nsHTMLSharedElement.cpp \
|
||||
|
|
|
@ -2734,7 +2734,8 @@ nsGenericHTMLFormElement::CanBeDisabled() const
|
|||
return
|
||||
type != NS_FORM_LABEL &&
|
||||
type != NS_FORM_OBJECT &&
|
||||
type != NS_FORM_OUTPUT;
|
||||
type != NS_FORM_OUTPUT &&
|
||||
type != NS_FORM_PROGRESS;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -1578,6 +1578,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
|
|||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
|
||||
#if defined(MOZ_MEDIA)
|
||||
|
|
|
@ -156,7 +156,8 @@ nsHTMLFieldSetElement::MatchListedElements(nsIContent* aContent, PRInt32 aNamesp
|
|||
nsIAtom* aAtom, void* aData)
|
||||
{
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aContent);
|
||||
return formControl && formControl->GetType() != NS_FORM_LABEL;
|
||||
return formControl && formControl->GetType() != NS_FORM_LABEL &&
|
||||
formControl->GetType() != NS_FORM_PROGRESS;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -221,6 +221,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
|
|||
//
|
||||
// NS_FORM_INPUT_IMAGE
|
||||
// NS_FORM_LABEL
|
||||
// NS_FORM_PROGRESS
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMHTMLProgressElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsAttrValue.h"
|
||||
#include "nsEventStateManager.h"
|
||||
|
||||
|
||||
class nsHTMLProgressElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLProgressElement
|
||||
{
|
||||
public:
|
||||
nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLProgressElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
|
||||
|
||||
// nsIDOMHTMLProgressElement
|
||||
NS_DECL_NSIDOMHTMLPROGRESSELEMENT
|
||||
|
||||
// nsIFormControl
|
||||
NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_PROGRESS; }
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
|
||||
|
||||
nsEventStates IntrinsicState() const;
|
||||
|
||||
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
|
||||
|
||||
PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
||||
const nsAString& aValue, nsAttrValue& aResult);
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns whethem the progress element is in the indeterminate state.
|
||||
* A progress element is in the indeterminate state if its value is ommited
|
||||
* or is not a floating point number..
|
||||
*
|
||||
* @return whether the progress element is in the indeterminate state.
|
||||
*/
|
||||
bool IsIndeterminate() const;
|
||||
|
||||
static const double kIndeterminatePosition;
|
||||
static const double kDefaultValue;
|
||||
static const double kDefaultMax;
|
||||
};
|
||||
|
||||
const double nsHTMLProgressElement::kIndeterminatePosition = -1.0;
|
||||
const double nsHTMLProgressElement::kDefaultValue = 0.0;
|
||||
const double nsHTMLProgressElement::kDefaultMax = 1.0;
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Progress)
|
||||
|
||||
|
||||
nsHTMLProgressElement::nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLFormElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLProgressElement::~nsHTMLProgressElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLProgressElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLProgressElement, nsGenericElement)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLProgressElement, nsHTMLProgressElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLProgressElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLProgressElement,
|
||||
nsIDOMHTMLProgressElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLProgressElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLProgressElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLProgressElement)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::Reset()
|
||||
{
|
||||
// The progress element is not resettable.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
||||
{
|
||||
// The progress element is not submittable.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStates
|
||||
nsHTMLProgressElement::IntrinsicState() const
|
||||
{
|
||||
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
||||
|
||||
if (IsIndeterminate()) {
|
||||
state |= NS_EVENT_STATE_INDETERMINATE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLProgressElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
||||
const nsAString& aValue, nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max) {
|
||||
return aResult.ParseDoubleValue(aValue);
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
|
||||
aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
return nsGenericHTMLFormElement::GetForm(aForm);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::GetValue(double* aValue)
|
||||
{
|
||||
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
|
||||
if (!attrValue || attrValue->Type() != nsAttrValue::eDoubleValue ||
|
||||
attrValue->GetDoubleValue() < 0.0) {
|
||||
*aValue = kDefaultValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aValue = attrValue->GetDoubleValue();
|
||||
|
||||
double max;
|
||||
GetMax(&max);
|
||||
|
||||
*aValue = PR_MIN(*aValue, max);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::SetValue(double aValue)
|
||||
{
|
||||
return SetDoubleAttr(nsGkAtoms::value, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::GetMax(double* aValue)
|
||||
{
|
||||
const nsAttrValue* attrMax = mAttrsAndChildren.GetAttr(nsGkAtoms::max);
|
||||
if (attrMax && attrMax->Type() == nsAttrValue::eDoubleValue &&
|
||||
attrMax->GetDoubleValue() > 0.0) {
|
||||
*aValue = attrMax->GetDoubleValue();
|
||||
} else {
|
||||
*aValue = kDefaultMax;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::SetMax(double aValue)
|
||||
{
|
||||
return SetDoubleAttr(nsGkAtoms::max, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLProgressElement::GetPosition(double* aPosition)
|
||||
{
|
||||
if (IsIndeterminate()) {
|
||||
*aPosition = kIndeterminatePosition;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
double value;
|
||||
double max;
|
||||
GetValue(&value);
|
||||
GetMax(&max);
|
||||
|
||||
*aPosition = value / max;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLProgressElement::IsIndeterminate() const
|
||||
{
|
||||
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
|
||||
return !attrValue || attrValue->Type() != nsAttrValue::eDoubleValue;
|
||||
}
|
||||
|
|
@ -262,6 +262,7 @@ _TEST_FILES = \
|
|||
test_bug641219.html \
|
||||
test_bug643051.html \
|
||||
test_bug583514.html \
|
||||
test_bug514437.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=514437
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633913
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 514437 and Bug 633913</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=514437">Mozilla Bug 514437</a>
|
||||
and
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633913">Mozilla Bug 633913</a>
|
||||
<p id="display"></p>
|
||||
<iframe name="submit_frame" onload="onFormSubmission();" style="visibility: hidden;"></iframe>
|
||||
<div id="content" style="visibility: hidden;">
|
||||
<form id='f' method='get' target='submit_frame' action='foo'>
|
||||
<progress id='p'></progress>
|
||||
</form>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 514437 and Bug 633913 **/
|
||||
|
||||
function checkFormIDLAttribute(aElement)
|
||||
{
|
||||
var form = document.forms[0];
|
||||
var content = document.getElementById('content');
|
||||
is(aElement.form, form, "The form IDL attribute should be the parent form");
|
||||
|
||||
content.removeChild(form);
|
||||
content.appendChild(aElement);
|
||||
is(aElement.form, null, "The form IDL attribute should be null");
|
||||
|
||||
// Cleaning-up.
|
||||
content.appendChild(form);
|
||||
form.appendChild(aElement);
|
||||
}
|
||||
|
||||
function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
|
||||
{
|
||||
var expectedValueForIDL = aNewValue;
|
||||
var expectedValueForContent = aNewValue;
|
||||
|
||||
if (aExpectedValueForIDL !== undefined) {
|
||||
expectedValueForIDL = aExpectedValueForIDL;
|
||||
}
|
||||
|
||||
if (aNewValue != null) {
|
||||
aElement.setAttribute(aAttribute, aNewValue);
|
||||
is(aElement.getAttribute(aAttribute), expectedValueForContent,
|
||||
aAttribute + " content attribute should be " + expectedValueForContent);
|
||||
is(aElement[aAttribute], expectedValueForIDL,
|
||||
aAttribute + " IDL attribute should be " + expectedValueForIDL);
|
||||
|
||||
if (parseFloat(aNewValue) == aNewValue) {
|
||||
aElement[aAttribute] = aNewValue;
|
||||
is(aElement.getAttribute(aAttribute), expectedValueForContent,
|
||||
aAttribute + " content attribute should be " + expectedValueForContent);
|
||||
is(aElement[aAttribute], parseFloat(expectedValueForIDL),
|
||||
aAttribute + " IDL attribute should be " + parseFloat(expectedValueForIDL));
|
||||
}
|
||||
} else {
|
||||
aElement.removeAttribute(aAttribute);
|
||||
is(aElement.getAttribute(aAttribute), expectedValueForContent,
|
||||
aAttribute + " content attribute should be " + expectedValueForContent);
|
||||
is(aElement[aAttribute], expectedValueForIDL,
|
||||
aAttribute + " IDL attribute should be " + expectedValueForIDL);
|
||||
}
|
||||
}
|
||||
|
||||
function checkValueAttribute()
|
||||
{
|
||||
var tests = [
|
||||
// value has to be a valid float, its default value is 0.0 otherwise.
|
||||
[ null, 0.0 ],
|
||||
[ 'fo', 0.0 ],
|
||||
// If value < 0.0, 0.0 is used instead.
|
||||
[ -1.0, 0.0 ],
|
||||
// If value >= max, max is used instead (max default value is 1.0).
|
||||
[ 2.0, 1.0 ],
|
||||
[ 1.0, 0.5, 0.5 ],
|
||||
[ 10.0, 5.0, 5.0 ],
|
||||
[ 13.37, 13.37, 42.0 ],
|
||||
// Regular reflection.
|
||||
[ 0.0 ],
|
||||
[ 0.5 ],
|
||||
[ 1.0 ],
|
||||
// Check double-precision value.
|
||||
[ 0.234567898765432 ],
|
||||
];
|
||||
|
||||
var element = document.createElement('progress');
|
||||
|
||||
for each(var test in tests) {
|
||||
if (test[2]) {
|
||||
element.setAttribute('max', test[2]);
|
||||
}
|
||||
|
||||
checkAttribute(element, 'value', test[0], test[1]);
|
||||
|
||||
element.removeAttribute('max');
|
||||
}
|
||||
}
|
||||
|
||||
function checkMaxAttribute()
|
||||
{
|
||||
var tests = [
|
||||
// max default value is 1.0.
|
||||
[ null, 1.0 ],
|
||||
// If value <= 0.0, 1.0 is used instead.
|
||||
[ 0.0, 1.0 ],
|
||||
[ -1.0, 1.0 ],
|
||||
// Regular reflection.
|
||||
[ 0.5 ],
|
||||
[ 1.0 ],
|
||||
[ 2.0 ],
|
||||
// Check double-precision value.
|
||||
[ 0.234567898765432 ],
|
||||
];
|
||||
|
||||
var element = document.createElement('progress');
|
||||
|
||||
for each(var test in tests) {
|
||||
checkAttribute(element, 'max', test[0], test[1]);
|
||||
}
|
||||
}
|
||||
|
||||
function checkPositionAttribute()
|
||||
{
|
||||
function checkPositionValue(aElement, aValue, aMax, aExpected) {
|
||||
if (aValue != null) {
|
||||
aElement.setAttribute('value', aValue);
|
||||
} else {
|
||||
aElement.removeAttribute('value');
|
||||
}
|
||||
|
||||
if (aMax != null) {
|
||||
aElement.setAttribute('max', aMax);
|
||||
} else {
|
||||
aElement.removeAttribute('max');
|
||||
}
|
||||
|
||||
is(aElement.position, aExpected, "position IDL attribute should be " + aExpected);
|
||||
}
|
||||
|
||||
var tests = [
|
||||
// value has to be defined (indeterminate state).
|
||||
[ null, null, -1.0 ],
|
||||
[ null, 1.0, -1.0 ],
|
||||
// value has to be defined to a valid float (indeterminate state).
|
||||
[ 'foo', 1.0, -1.0 ],
|
||||
// If value < 0.0, 0.0 is used instead.
|
||||
[ -1.0, 1.0, 0.0 ],
|
||||
// If value >= max, max is used instead.
|
||||
[ 2.0, 1.0, 1.0 ],
|
||||
// If max isn't present, max is set to 1.0.
|
||||
[ 1.0, null, 1.0 ],
|
||||
// If max isn't a valid float, max is set to 1.0.
|
||||
[ 1.0, 'foo', 1.0 ],
|
||||
// If max isn't > 0, max is set to 1.0.
|
||||
[ 1.0, -1.0, 1.0 ],
|
||||
// A few simple and valid values.
|
||||
[ 0.0, 1.0, 0.0 ],
|
||||
[ 0.1, 1.0, 0.1/1.0 ],
|
||||
[ 0.1, 2.0, 0.1/2.0 ],
|
||||
[ 10, 50, 10/50 ],
|
||||
// Values implying .position is a double.
|
||||
[ 1.0, 3.0, 1.0/3.0 ],
|
||||
[ 0.1, 0.7, 0.1/0.7 ],
|
||||
];
|
||||
|
||||
var element = document.createElement('progress');
|
||||
|
||||
for each(var test in tests) {
|
||||
checkPositionValue(element, test[0], test[1], test[2], test[3]);
|
||||
}
|
||||
}
|
||||
|
||||
function checkIndeterminatePseudoClass()
|
||||
{
|
||||
function checkIndeterminate(aElement, aValue, aMax, aIndeterminate) {
|
||||
if (aValue != null) {
|
||||
aElement.setAttribute('value', aValue);
|
||||
} else {
|
||||
aElement.removeAttribute('value');
|
||||
}
|
||||
|
||||
if (aMax != null) {
|
||||
aElement.setAttribute('max', aMax);
|
||||
} else {
|
||||
aElement.removeAttribute('max');
|
||||
}
|
||||
|
||||
is(aElement.mozMatchesSelector("progress:indeterminate"), aIndeterminate,
|
||||
"<progress> indeterminate state should be " + aIndeterminate);
|
||||
}
|
||||
|
||||
var tests = [
|
||||
// Indeterminate state: (value is undefined, or not a float)
|
||||
// value has to be defined (indeterminate state).
|
||||
[ null, null, true ],
|
||||
[ null, 1.0, true ],
|
||||
[ 'foo', 1.0, true ],
|
||||
// Determined state:
|
||||
[ -1.0, 1.0, false ],
|
||||
[ 2.0, 1.0, false ],
|
||||
[ 1.0, null, false ],
|
||||
[ 1.0, 'foo', false ],
|
||||
[ 1.0, -1.0, false ],
|
||||
[ 0.0, 1.0, false ],
|
||||
];
|
||||
|
||||
var element = document.createElement('progress');
|
||||
|
||||
for each(var test in tests) {
|
||||
checkIndeterminate(element, test[0], test[1], test[2]);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFormListedElement(aElement)
|
||||
{
|
||||
is(document.forms[0].elements.length, 0, "the form should have no element");
|
||||
}
|
||||
|
||||
function checkLabelable(aElement)
|
||||
{
|
||||
var content = document.getElementById('content');
|
||||
var label = document.createElement('label');
|
||||
|
||||
content.appendChild(label);
|
||||
label.appendChild(aElement);
|
||||
is(label.control, aElement, "progress should be labelable");
|
||||
|
||||
// Cleaning-up.
|
||||
content.removeChild(label);
|
||||
content.appendChild(aElement);
|
||||
}
|
||||
|
||||
function checkNotResetableAndFormSubmission(aElement)
|
||||
{
|
||||
// Creating an input element to check the submission worked.
|
||||
var form = document.forms[0];
|
||||
var input = document.createElement('input');
|
||||
|
||||
input.name = 'a';
|
||||
input.value = 'tulip';
|
||||
form.appendChild(input);
|
||||
|
||||
// Setting values.
|
||||
aElement.value = 42.0;
|
||||
aElement.max = 100.0;
|
||||
|
||||
// This is going to call onFormSubmission().
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function onFormSubmission()
|
||||
{
|
||||
/**
|
||||
* All elements values have been set just before the submission.
|
||||
* The input element value should be in the submit url but the progress
|
||||
* element value should not appear.
|
||||
*/
|
||||
is(frames['submit_frame'].location.href,
|
||||
'http://mochi.test:8888/tests/content/html/content/test/foo?a=tulip',
|
||||
"The progress element value should not be submitted");
|
||||
|
||||
checkNotResetable();
|
||||
}
|
||||
|
||||
function checkNotResetable()
|
||||
{
|
||||
// Try to reset the form.
|
||||
var form = document.forms[0];
|
||||
var element = document.getElementById('p');
|
||||
|
||||
element.value = 3.0;
|
||||
element.max = 42.0;
|
||||
|
||||
form.reset();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
is(element.value, 3.0, "progress.value should not have changed");
|
||||
is(element.max, 42.0, "progress.max should not have changed");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var p = document.getElementById('p');
|
||||
|
||||
ok(p instanceof HTMLProgressElement,
|
||||
"The progress element should be instance of HTMLProgressElement");
|
||||
is(p.constructor, HTMLProgressElement,
|
||||
"The progress element constructor should be HTMLProgressElement");
|
||||
|
||||
checkFormIDLAttribute(p);
|
||||
|
||||
checkValueAttribute();
|
||||
|
||||
checkMaxAttribute();
|
||||
|
||||
checkPositionAttribute();
|
||||
|
||||
checkIndeterminatePseudoClass();
|
||||
|
||||
checkFormListedElement(p);
|
||||
|
||||
checkLabelable(p);
|
||||
|
||||
checkNotResetableAndFormSubmission(p);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -401,13 +401,12 @@ var forms = [
|
|||
|
||||
var elementNames = [
|
||||
'button', 'fieldset', 'input', 'label', 'object', 'output', 'select',
|
||||
'textarea',
|
||||
'textarea', 'progress',
|
||||
];
|
||||
|
||||
var todoElements = [
|
||||
['keygen', 'Keygen'],
|
||||
['meter', 'Meter'],
|
||||
['progress', 'Progress'],
|
||||
];
|
||||
|
||||
for each(var e in todoElements) {
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
// { %%%%% begin platform defs peculiar to Mork %%%%%
|
||||
|
||||
//#define XP_MAC 1
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#define MORK_MAC 1
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ FORCE_SHARED_LIB = 1
|
|||
VISIBILITY_FLAGS =
|
||||
LIB_IS_C_ONLY = 1
|
||||
|
||||
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifndef GNU_CC
|
||||
DEFFILE = $(CURDIR)/sqlite-processed.def
|
||||
RCFILE = sqlite.rc
|
||||
|
|
|
@ -817,16 +817,6 @@ const char * nsDefaultURIFixup::GetFileSystemCharset()
|
|||
const char * nsDefaultURIFixup::GetCharsetForUrlBar()
|
||||
{
|
||||
const char *charset = GetFileSystemCharset();
|
||||
#ifdef XP_MAC
|
||||
// check for "x-mac-" prefix
|
||||
if ((strlen(charset) >= 6) && charset[0] == 'x' && charset[2] == 'm')
|
||||
{
|
||||
if (!strcmp("x-mac-roman", charset))
|
||||
return "ISO-8859-1";
|
||||
// we can do more x-mac-xxxx mapping here
|
||||
// or somewhere in intl code like nsIPlatformCharset.
|
||||
}
|
||||
#endif
|
||||
return charset;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
interface nsIDOMNode;
|
||||
|
||||
|
||||
[scriptable, uuid(19187542-1f4d-46e1-9b2d-d5de02dace85)]
|
||||
[scriptable, uuid(00d3454c-e125-4cce-bfec-adfbf0975e05)]
|
||||
interface nsIMarkupDocumentViewer : nsISupports
|
||||
{
|
||||
|
||||
|
@ -142,20 +142,13 @@ interface nsIMarkupDocumentViewer : nsISupports
|
|||
*/
|
||||
attribute octet bidiSupport;
|
||||
|
||||
/**
|
||||
* bidiCharacterSet: whether to force the user's character set
|
||||
* 1 - use the document character set
|
||||
* 2 - use the character set chosen by the user
|
||||
*/
|
||||
attribute octet bidiCharacterSet;
|
||||
|
||||
/**
|
||||
* Use this attribute to access all the Bidi options in one operation
|
||||
*/
|
||||
attribute PRUint32 bidiOptions;
|
||||
};
|
||||
|
||||
[scriptable, uuid(cadfcad1-5570-4dac-b5a2-cd1ea751fe29)]
|
||||
[scriptable, uuid(83b28afd-75a7-4d13-9265-625e36861f04)]
|
||||
interface nsIMarkupDocumentViewer_MOZILLA_2_0_BRANCH : nsIMarkupDocumentViewer
|
||||
{
|
||||
/** The minimum font size */
|
||||
|
|
|
@ -300,6 +300,7 @@
|
|||
#include "nsIDOMHTMLParagraphElement.h"
|
||||
#include "nsIDOMHTMLParamElement.h"
|
||||
#include "nsIDOMHTMLPreElement.h"
|
||||
#include "nsIDOMHTMLProgressElement.h"
|
||||
#include "nsIDOMHTMLQuoteElement.h"
|
||||
#include "nsIDOMHTMLScriptElement.h"
|
||||
#include "nsIDOMHTMLStyleElement.h"
|
||||
|
@ -510,6 +511,7 @@
|
|||
#include "nsIDOMMediaQueryList.h"
|
||||
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsIDOMCustomEvent.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -848,6 +850,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLPreElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLProgressElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLQuoteElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLScriptElement, nsElementSH,
|
||||
|
@ -1513,6 +1517,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
|
||||
NS_DEFINE_CLASSINFO_DATA(MediaQueryList, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CustomEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
};
|
||||
|
||||
// Objects that should be constructable through |new Name();|
|
||||
|
@ -1561,7 +1567,6 @@ PRBool nsDOMClassInfo::sDisableDocumentAllSupport = PR_FALSE;
|
|||
PRBool nsDOMClassInfo::sDisableGlobalScopePollutionSupport = PR_FALSE;
|
||||
|
||||
|
||||
jsid nsDOMClassInfo::sTop_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sParent_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sScrollbars_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sLocation_id = JSID_VOID;
|
||||
|
@ -1896,7 +1901,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
|
|||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
SET_JSID_TO_STRING(sTop_id, cx, "top");
|
||||
SET_JSID_TO_STRING(sParent_id, cx, "parent");
|
||||
SET_JSID_TO_STRING(sScrollbars_id, cx, "scrollbars");
|
||||
SET_JSID_TO_STRING(sLocation_id, cx, "location");
|
||||
|
@ -2873,6 +2877,11 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(HTMLProgressElement, nsIDOMHTMLProgressElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLProgressElement)
|
||||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(HTMLQuoteElement, nsIDOMHTMLQuoteElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLQuoteElement)
|
||||
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
|
||||
|
@ -4331,6 +4340,11 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMediaQueryList)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CustomEvent, nsIDOMCustomEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCustomEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
{
|
||||
PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData);
|
||||
|
@ -5014,7 +5028,6 @@ nsDOMClassInfo::ShutDown()
|
|||
}
|
||||
}
|
||||
|
||||
sTop_id = JSID_VOID;
|
||||
sParent_id = JSID_VOID;
|
||||
sScrollbars_id = JSID_VOID;
|
||||
sLocation_id = JSID_VOID;
|
||||
|
|
|
@ -202,8 +202,7 @@ protected:
|
|||
|
||||
static inline PRBool IsReadonlyReplaceable(jsid id)
|
||||
{
|
||||
return (id == sTop_id ||
|
||||
id == sParent_id ||
|
||||
return (id == sParent_id ||
|
||||
id == sScrollbars_id ||
|
||||
id == sContent_id ||
|
||||
id == sMenubar_id ||
|
||||
|
@ -246,7 +245,6 @@ protected:
|
|||
static PRBool sDisableGlobalScopePollutionSupport;
|
||||
|
||||
public:
|
||||
static jsid sTop_id;
|
||||
static jsid sParent_id;
|
||||
static jsid sScrollbars_id;
|
||||
static jsid sLocation_id;
|
||||
|
|
|
@ -127,6 +127,7 @@ DOMCI_CLASS(HTMLOutputElement)
|
|||
DOMCI_CLASS(HTMLParagraphElement)
|
||||
DOMCI_CLASS(HTMLParamElement)
|
||||
DOMCI_CLASS(HTMLPreElement)
|
||||
DOMCI_CLASS(HTMLProgressElement)
|
||||
DOMCI_CLASS(HTMLQuoteElement)
|
||||
DOMCI_CLASS(HTMLScriptElement)
|
||||
DOMCI_CLASS(HTMLSelectElement)
|
||||
|
@ -522,3 +523,4 @@ DOMCI_CLASS(MozCSSKeyframesRule)
|
|||
#endif
|
||||
|
||||
DOMCI_CLASS(MediaQueryList)
|
||||
DOMCI_CLASS(CustomEvent)
|
||||
|
|
|
@ -818,7 +818,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
|||
mCleanMessageManager(PR_FALSE),
|
||||
mNeedsFocus(PR_TRUE),
|
||||
mHasFocus(PR_FALSE),
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
mShowAccelerators(PR_FALSE),
|
||||
mShowFocusRings(PR_FALSE),
|
||||
#else
|
||||
|
@ -4091,7 +4091,7 @@ nsGlobalWindow::CheckSecurityLeftAndTop(PRInt32* aLeft, PRInt32* aTop)
|
|||
screen->GetAvailLeft(&screenLeft);
|
||||
screen->GetAvailWidth(&screenWidth);
|
||||
screen->GetAvailHeight(&screenHeight);
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
/* The mac's coordinate system is different from the assumed Windows'
|
||||
system. It offsets by the height of the menubar so that a window
|
||||
placed at (0,0) will be entirely visible. Unfortunately that
|
||||
|
@ -4431,7 +4431,7 @@ nsGlobalWindow::Dump(const nsAString& aStr)
|
|||
|
||||
char *cstr = ToNewUTF8String(aStr);
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
// have to convert \r to \n so that printing to the console works
|
||||
char *c = cstr, *cEnd = cstr + strlen(cstr);
|
||||
while (c < cEnd) {
|
||||
|
|
|
@ -90,6 +90,7 @@ XPIDLSRCS = \
|
|||
nsIDOMEventException.idl \
|
||||
nsIDOMTouchEvent.idl \
|
||||
nsIDOMHashChangeEvent.idl \
|
||||
nsIDOMCustomEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_CSS_ANIMATIONS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -12,18 +12,18 @@
|
|||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
* The Original Code is nsIDOMCustomEvent.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
|
@ -34,32 +34,18 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIMacLocale_h__
|
||||
#define nsIMacLocale_h__
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
interface nsIVariant;
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
[scriptable, uuid(e93f84c5-e72f-4429-b797-f0c28d87890f)]
|
||||
interface nsIDOMCustomEvent : nsIDOMEvent
|
||||
{
|
||||
|
||||
// {E58B24B2-FD1A-11d2-9E8E-0060089FE59B}
|
||||
#define NS_IMACLOCALE_IID \
|
||||
{ 0xe58b24b2, 0xfd1a, 0x11d2, \
|
||||
{ 0x9e, 0x8e, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b }}
|
||||
readonly attribute nsIVariant detail;
|
||||
|
||||
|
||||
class nsIMacLocale : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMACLOCALE_IID)
|
||||
|
||||
NS_IMETHOD GetPlatformLocale(const nsAString& locale, short* scriptCode,
|
||||
short* langCode, short* regionCode) = 0;
|
||||
NS_IMETHOD GetXPLocale(short scriptCode, short langCode, short regionCode,
|
||||
nsAString& locale) = 0;
|
||||
void initCustomEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIVariant detailArg);
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMacLocale, NS_IMACLOCALE_IID)
|
||||
|
||||
#endif
|
|
@ -92,6 +92,7 @@ SDK_XPIDLSRCS = \
|
|||
nsIDOMHTMLParagraphElement.idl \
|
||||
nsIDOMHTMLParamElement.idl \
|
||||
nsIDOMHTMLPreElement.idl \
|
||||
nsIDOMHTMLProgressElement.idl \
|
||||
nsIDOMHTMLQuoteElement.idl \
|
||||
nsIDOMHTMLScriptElement.idl \
|
||||
nsIDOMHTMLSelectElement.idl \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -14,12 +14,12 @@
|
|||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -34,30 +34,29 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsMacLocale_h__
|
||||
#define nsMacLocale_h__
|
||||
|
||||
#include "nsIDOMHTMLElement.idl"
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMacLocale.h"
|
||||
|
||||
|
||||
|
||||
class nsMacLocale : public nsIMacLocale {
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
nsMacLocale();
|
||||
virtual ~nsMacLocale();
|
||||
|
||||
NS_IMETHOD GetPlatformLocale(const nsAString& locale,short* scriptCode, short* langCode, short* regionCode);
|
||||
NS_IMETHOD GetXPLocale(short scriptCode, short langCode, short regionCode, nsAString& locale);
|
||||
/**
|
||||
* The nsIDOMHTMLProgressElement interface is the interface to a HTML
|
||||
* <progress> element.
|
||||
*
|
||||
* For more information on this interface, please see
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#the-progress-element
|
||||
*
|
||||
* @status UNDER_DEVELOPMENT
|
||||
*/
|
||||
|
||||
[scriptable, uuid(d14250f5-3176-4244-8085-1d0a532ce44c)]
|
||||
interface nsIDOMHTMLProgressElement : nsIDOMHTMLElement
|
||||
{
|
||||
attribute double value;
|
||||
attribute double max;
|
||||
readonly attribute double position;
|
||||
readonly attribute nsIDOMHTMLFormElement form;
|
||||
/**
|
||||
* The labels attribute will be done with bug 567740.
|
||||
*/
|
||||
//readonly attribute NodeList labels;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1454,11 +1454,9 @@ public:
|
|||
{
|
||||
if (!aTag)
|
||||
return;
|
||||
CopyUTF8toUTF16(aTag->mMimeDescriptionArray[aMimeTypeIndex], mDescription);
|
||||
if (aTag->mExtensionsArray)
|
||||
CopyUTF8toUTF16(aTag->mExtensionsArray[aMimeTypeIndex], mSuffixes);
|
||||
if (aTag->mMimeTypeArray)
|
||||
CopyUTF8toUTF16(aTag->mMimeTypeArray[aMimeTypeIndex], mType);
|
||||
CopyUTF8toUTF16(aTag->mMimeDescriptions[aMimeTypeIndex], mDescription);
|
||||
CopyUTF8toUTF16(aTag->mExtensions[aMimeTypeIndex], mSuffixes);
|
||||
CopyUTF8toUTF16(aTag->mMimeTypes[aMimeTypeIndex], mType);
|
||||
}
|
||||
|
||||
virtual ~DOMMimeTypeImpl() {
|
||||
|
@ -1543,7 +1541,7 @@ public:
|
|||
|
||||
NS_METHOD GetLength(PRUint32* aLength)
|
||||
{
|
||||
*aLength = mPluginTag.mVariants;
|
||||
*aLength = mPluginTag.mMimeTypes.Length();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1557,8 +1555,8 @@ public:
|
|||
|
||||
NS_METHOD NamedItem(const nsAString& aName, nsIDOMMimeType** aReturn)
|
||||
{
|
||||
for (int i = mPluginTag.mVariants - 1; i >= 0; --i) {
|
||||
if (aName.Equals(NS_ConvertUTF8toUTF16(mPluginTag.mMimeTypeArray[i])))
|
||||
for (int i = mPluginTag.mMimeTypes.Length() - 1; i >= 0; --i) {
|
||||
if (aName.Equals(NS_ConvertUTF8toUTF16(mPluginTag.mMimeTypes[i])))
|
||||
return Item(i, aReturn);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1650,10 +1648,9 @@ nsPluginHost::FindPluginForType(const char* aMimeType,
|
|||
nsPluginTag *plugin = mPlugins;
|
||||
while (plugin) {
|
||||
if (!aCheckEnabled || plugin->IsEnabled()) {
|
||||
PRInt32 mimeCount = plugin->mVariants;
|
||||
PRInt32 mimeCount = plugin->mMimeTypes.Length();
|
||||
for (PRInt32 i = 0; i < mimeCount; i++) {
|
||||
if (plugin->mMimeTypeArray[i] &&
|
||||
(0 == PL_strcasecmp(plugin->mMimeTypeArray[i], aMimeType))) {
|
||||
if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
|
@ -1668,31 +1665,25 @@ nsPluginTag*
|
|||
nsPluginHost::FindPluginEnabledForExtension(const char* aExtension,
|
||||
const char*& aMimeType)
|
||||
{
|
||||
nsPluginTag *plugins = nsnull;
|
||||
PRInt32 variants, cnt;
|
||||
if (!aExtension) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
LoadPlugins();
|
||||
|
||||
// if we have a mimetype passed in, search the mPlugins linked
|
||||
// list for a match
|
||||
if (aExtension) {
|
||||
plugins = mPlugins;
|
||||
while (plugins) {
|
||||
variants = plugins->mVariants;
|
||||
if (plugins->mExtensionsArray) {
|
||||
for (cnt = 0; cnt < variants; cnt++) {
|
||||
// mExtensionsArray[cnt] is a list of extensions separated
|
||||
// by commas
|
||||
if (plugins->IsEnabled() &&
|
||||
0 == CompareExtensions(plugins->mExtensionsArray[cnt], aExtension)) {
|
||||
aMimeType = plugins->mMimeTypeArray[cnt];
|
||||
return plugins;
|
||||
nsPluginTag *plugin = mPlugins;
|
||||
while (plugin) {
|
||||
if (plugin->IsEnabled()) {
|
||||
PRInt32 variants = plugin->mExtensions.Length();
|
||||
for (PRInt32 i = 0; i < variants; i++) {
|
||||
// mExtensionsArray[cnt] is a list of extensions separated by commas
|
||||
if (0 == CompareExtensions(plugin->mExtensions[i].get(), aExtension)) {
|
||||
aMimeType = plugin->mMimeTypes[i].get();
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins = plugins->mNext;
|
||||
}
|
||||
plugin = plugin->mNext;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -2679,13 +2670,13 @@ nsPluginHost::WritePluginInfo()
|
|||
// filename & fullpath are on separate line
|
||||
// because they can contain field delimiter char
|
||||
PR_fprintf(fd, "%s%c%c\n%s%c%c\n%s%c%c\n",
|
||||
(!tag->mFileName.IsEmpty() ? tag->mFileName.get() : ""),
|
||||
(tag->mFileName.get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
(!tag->mFullPath.IsEmpty() ? tag->mFullPath.get() : ""),
|
||||
(tag->mFullPath.get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
(!tag->mVersion.IsEmpty() ? tag->mVersion.get() : ""),
|
||||
(tag->mVersion.get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER);
|
||||
|
||||
|
@ -2701,30 +2692,30 @@ nsPluginHost::WritePluginInfo()
|
|||
|
||||
//description, name & mtypecount are on separate line
|
||||
PR_fprintf(fd, "%s%c%c\n%s%c%c\n%d\n",
|
||||
(!tag->mDescription.IsEmpty() ? tag->mDescription.get() : ""),
|
||||
(tag->mDescription.get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
(!tag->mName.IsEmpty() ? tag->mName.get() : ""),
|
||||
(tag->mName.get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER,
|
||||
tag->mVariants + (tag->mIsNPRuntimeEnabledJavaPlugin ? 1 : 0));
|
||||
tag->mMimeTypes.Length() + (tag->mIsNPRuntimeEnabledJavaPlugin ? 1 : 0));
|
||||
|
||||
// Add in each mimetype this plugin supports
|
||||
for (int i=0; i<tag->mVariants; i++) {
|
||||
for (PRUint32 i = 0; i < tag->mMimeTypes.Length(); i++) {
|
||||
PR_fprintf(fd, "%d%c%s%c%s%c%s%c%c\n",
|
||||
i,PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
(tag->mMimeTypeArray && tag->mMimeTypeArray[i] ? tag->mMimeTypeArray[i] : ""),
|
||||
(tag->mMimeTypes[i].get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
(!tag->mMimeDescriptionArray[i].IsEmpty() ? tag->mMimeDescriptionArray[i].get() : ""),
|
||||
(tag->mMimeDescriptions[i].get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
(tag->mExtensionsArray && tag->mExtensionsArray[i] ? tag->mExtensionsArray[i] : ""),
|
||||
(tag->mExtensions[i].get()),
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
PLUGIN_REGISTRY_END_OF_LINE_MARKER);
|
||||
}
|
||||
|
||||
if (tag->mIsNPRuntimeEnabledJavaPlugin) {
|
||||
PR_fprintf(fd, "%d%c%s%c%s%c%s%c%c\n",
|
||||
tag->mVariants, PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
tag->mMimeTypes.Length(), PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
"application/x-java-vm-npruntime",
|
||||
PLUGIN_REGISTRY_FIELD_DELIMITER,
|
||||
"",
|
||||
|
|
|
@ -76,10 +76,9 @@ nsPluginTag::nsPluginTag(nsPluginTag* aPluginTag)
|
|||
: mPluginHost(nsnull),
|
||||
mName(aPluginTag->mName),
|
||||
mDescription(aPluginTag->mDescription),
|
||||
mVariants(aPluginTag->mVariants),
|
||||
mMimeTypeArray(nsnull),
|
||||
mMimeDescriptionArray(aPluginTag->mMimeDescriptionArray),
|
||||
mExtensionsArray(nsnull),
|
||||
mMimeTypes(aPluginTag->mMimeTypes),
|
||||
mMimeDescriptions(aPluginTag->mMimeDescriptions),
|
||||
mExtensions(aPluginTag->mExtensions),
|
||||
mLibrary(nsnull),
|
||||
mCanUnloadLibrary(PR_TRUE),
|
||||
mIsJavaPlugin(aPluginTag->mIsJavaPlugin),
|
||||
|
@ -91,26 +90,12 @@ mVersion(aPluginTag->mVersion),
|
|||
mLastModifiedTime(0),
|
||||
mFlags(NS_PLUGIN_FLAG_ENABLED)
|
||||
{
|
||||
if (aPluginTag->mMimeTypeArray != nsnull) {
|
||||
mMimeTypeArray = new char*[mVariants];
|
||||
for (int i = 0; i < mVariants; i++)
|
||||
mMimeTypeArray[i] = new_str(aPluginTag->mMimeTypeArray[i]);
|
||||
}
|
||||
|
||||
if (aPluginTag->mExtensionsArray != nsnull) {
|
||||
mExtensionsArray = new char*[mVariants];
|
||||
for (int i = 0; i < mVariants; i++)
|
||||
mExtensionsArray[i] = new_str(aPluginTag->mExtensionsArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo)
|
||||
: mPluginHost(nsnull),
|
||||
mName(aPluginInfo->fName),
|
||||
mDescription(aPluginInfo->fDescription),
|
||||
mVariants(aPluginInfo->fVariantCount),
|
||||
mMimeTypeArray(nsnull),
|
||||
mExtensionsArray(nsnull),
|
||||
mLibrary(nsnull),
|
||||
#ifdef XP_MACOSX
|
||||
mCanUnloadLibrary(PR_FALSE),
|
||||
|
@ -126,39 +111,37 @@ mVersion(aPluginInfo->fVersion),
|
|||
mLastModifiedTime(0),
|
||||
mFlags(NS_PLUGIN_FLAG_ENABLED)
|
||||
{
|
||||
PRInt32 javaSentinelVariant = -1;
|
||||
|
||||
if (aPluginInfo->fMimeTypeArray) {
|
||||
mMimeTypeArray = new char*[mVariants];
|
||||
for (int i = 0; i < mVariants; i++) {
|
||||
char* currentMIMEType = aPluginInfo->fMimeTypeArray[i];
|
||||
if (!currentMIMEType) {
|
||||
continue;
|
||||
if (!aPluginInfo->fMimeTypeArray) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PRUint32 i = 0; i < aPluginInfo->fVariantCount; i++) {
|
||||
// First fill in the MIME types.
|
||||
char* currentMIMEType = aPluginInfo->fMimeTypeArray[i];
|
||||
if (currentMIMEType) {
|
||||
if (mIsJavaPlugin) {
|
||||
if (strcmp(currentMIMEType, "application/x-java-vm-npruntime") == 0) {
|
||||
// This "magic MIME type" should not be exposed, but is just a signal
|
||||
// to the browser that this is new-style java.
|
||||
// Remove it and its associated MIME description from our arrays.
|
||||
// Don't add it or its associated information to our arrays.
|
||||
mIsNPRuntimeEnabledJavaPlugin = PR_TRUE;
|
||||
javaSentinelVariant = i;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
mMimeTypeArray[i] = new_str(currentMIMEType);
|
||||
|
||||
if (nsPluginHost::IsJavaMIMEType(mMimeTypeArray[i])) {
|
||||
mMimeTypes.AppendElement(nsCString(currentMIMEType));
|
||||
if (nsPluginHost::IsJavaMIMEType(currentMIMEType)) {
|
||||
mIsJavaPlugin = PR_TRUE;
|
||||
}
|
||||
else if (strcmp(currentMIMEType, "application/x-shockwave-flash") == 0) {
|
||||
mIsFlashPlugin = PR_TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aPluginInfo->fMimeDescriptionArray) {
|
||||
for (int i = 0; i < mVariants; i++) {
|
||||
// Now fill in the MIME descriptions.
|
||||
if (aPluginInfo->fMimeDescriptionArray &&
|
||||
aPluginInfo->fMimeDescriptionArray[i]) {
|
||||
// we should cut off the list of suffixes which the mime
|
||||
// description string may have, see bug 53895
|
||||
// it is usually in form "some description (*.sf1, *.sf2)"
|
||||
|
@ -174,27 +157,25 @@ mFlags(NS_PLUGIN_FLAG_ENABLED)
|
|||
cur = *p;
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
}
|
||||
mMimeDescriptionArray.AppendElement(
|
||||
aPluginInfo->fMimeDescriptionArray[i]);
|
||||
mMimeDescriptions.AppendElement(nsCString(aPluginInfo->fMimeDescriptionArray[i]));
|
||||
// restore the original string
|
||||
if (cur != '\0')
|
||||
*p = cur;
|
||||
if (pre != '\0')
|
||||
*(p - 1) = pre;
|
||||
}
|
||||
} else {
|
||||
mMimeDescriptionArray.SetLength(mVariants);
|
||||
mMimeDescriptions.AppendElement(nsCString());
|
||||
}
|
||||
|
||||
if (aPluginInfo->fExtensionArray != nsnull) {
|
||||
mExtensionsArray = new char*[mVariants];
|
||||
for (int i = 0; i < mVariants; i++)
|
||||
mExtensionsArray[i] = new_str(aPluginInfo->fExtensionArray[i]);
|
||||
// Now fill in the extensions.
|
||||
if (aPluginInfo->fExtensionArray &&
|
||||
aPluginInfo->fExtensionArray[i]) {
|
||||
mExtensions.AppendElement(nsCString(aPluginInfo->fExtensionArray[i]));
|
||||
} else {
|
||||
mExtensions.AppendElement(nsCString());
|
||||
}
|
||||
}
|
||||
|
||||
RemoveJavaSentinel(javaSentinelVariant);
|
||||
|
||||
EnsureMembersAreUTF8();
|
||||
}
|
||||
|
@ -214,9 +195,6 @@ nsPluginTag::nsPluginTag(const char* aName,
|
|||
: mPluginHost(nsnull),
|
||||
mName(aName),
|
||||
mDescription(aDescription),
|
||||
mVariants(aVariants),
|
||||
mMimeTypeArray(nsnull),
|
||||
mExtensionsArray(nsnull),
|
||||
mLibrary(nsnull),
|
||||
mCanUnloadLibrary(aCanUnload),
|
||||
mIsJavaPlugin(PR_FALSE),
|
||||
|
@ -227,29 +205,20 @@ mVersion(aVersion),
|
|||
mLastModifiedTime(aLastModifiedTime),
|
||||
mFlags(0) // Caller will read in our flags from cache
|
||||
{
|
||||
PRInt32 javaSentinelVariant = -1;
|
||||
|
||||
if (aVariants) {
|
||||
mMimeTypeArray = new char*[mVariants];
|
||||
mExtensionsArray = new char*[mVariants];
|
||||
|
||||
for (PRInt32 i = 0; i < aVariants; ++i) {
|
||||
for (PRInt32 i = 0; i < aVariants; i++) {
|
||||
if (mIsJavaPlugin && aMimeTypes[i] &&
|
||||
strcmp(aMimeTypes[i], "application/x-java-vm-npruntime") == 0) {
|
||||
mIsNPRuntimeEnabledJavaPlugin = PR_TRUE;
|
||||
javaSentinelVariant = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
mMimeTypeArray[i] = new_str(aMimeTypes[i]);
|
||||
mMimeDescriptionArray.AppendElement(aMimeDescriptions[i]);
|
||||
mExtensionsArray[i] = new_str(aExtensions[i]);
|
||||
if (nsPluginHost::IsJavaMIMEType(mMimeTypeArray[i]))
|
||||
mMimeTypes.AppendElement(nsCString(aMimeTypes[i]));
|
||||
mMimeDescriptions.AppendElement(nsCString(aMimeDescriptions[i]));
|
||||
mExtensions.AppendElement(nsCString(aExtensions[i]));
|
||||
if (nsPluginHost::IsJavaMIMEType(mMimeTypes[i].get())) {
|
||||
mIsJavaPlugin = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
RemoveJavaSentinel(javaSentinelVariant);
|
||||
|
||||
if (!aArgsAreUTF8)
|
||||
EnsureMembersAreUTF8();
|
||||
}
|
||||
|
@ -257,22 +226,6 @@ mFlags(0) // Caller will read in our flags from cache
|
|||
nsPluginTag::~nsPluginTag()
|
||||
{
|
||||
NS_ASSERTION(!mNext, "Risk of exhausting the stack space, bug 486349");
|
||||
|
||||
if (mMimeTypeArray) {
|
||||
for (int i = 0; i < mVariants; i++)
|
||||
delete[] mMimeTypeArray[i];
|
||||
|
||||
delete[] (mMimeTypeArray);
|
||||
mMimeTypeArray = nsnull;
|
||||
}
|
||||
|
||||
if (mExtensionsArray) {
|
||||
for (int i = 0; i < mVariants; i++)
|
||||
delete[] mExtensionsArray[i];
|
||||
|
||||
delete[] (mExtensionsArray);
|
||||
mExtensionsArray = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPluginTag, nsIPluginTag)
|
||||
|
@ -334,8 +287,8 @@ nsresult nsPluginTag::EnsureMembersAreUTF8()
|
|||
|
||||
ConvertToUTF8(decoder, mName);
|
||||
ConvertToUTF8(decoder, mDescription);
|
||||
for (PRUint32 i = 0; i < mMimeDescriptionArray.Length(); ++i) {
|
||||
ConvertToUTF8(decoder, mMimeDescriptionArray[i]);
|
||||
for (PRUint32 i = 0; i < mMimeDescriptions.Length(); ++i) {
|
||||
ConvertToUTF8(decoder, mMimeDescriptions[i]);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -430,9 +383,6 @@ void
|
|||
nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
|
||||
nsPluginTag::nsRegisterType aType)
|
||||
{
|
||||
if (!mMimeTypeArray)
|
||||
return;
|
||||
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("nsPluginTag::RegisterWithCategoryManager plugin=%s, removing = %s\n",
|
||||
mFileName.get(), aType == ePluginUnregister ? "yes" : "no"));
|
||||
|
@ -464,16 +414,16 @@ nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
|
|||
}
|
||||
|
||||
nsACString::const_iterator start, end;
|
||||
for (int i = 0; i < mVariants; i++) {
|
||||
for (PRUint32 i = 0; i < mMimeTypes.Length(); i++) {
|
||||
if (aType == ePluginUnregister) {
|
||||
nsXPIDLCString value;
|
||||
if (NS_SUCCEEDED(catMan->GetCategoryEntry("Gecko-Content-Viewers",
|
||||
mMimeTypeArray[i],
|
||||
mMimeTypes[i].get(),
|
||||
getter_Copies(value)))) {
|
||||
// Only delete the entry if a plugin registered for it
|
||||
if (strcmp(value, contractId) == 0) {
|
||||
catMan->DeleteCategoryEntry("Gecko-Content-Viewers",
|
||||
mMimeTypeArray[i],
|
||||
mMimeTypes[i].get(),
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -481,14 +431,13 @@ nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
|
|||
overrideTypesFormatted.BeginReading(start);
|
||||
overrideTypesFormatted.EndReading(end);
|
||||
|
||||
nsDependentCString mimeType(mMimeTypeArray[i]);
|
||||
nsCAutoString commaSeparated;
|
||||
commaSeparated.Assign(',');
|
||||
commaSeparated += mimeType;
|
||||
commaSeparated += mMimeTypes[i];
|
||||
commaSeparated.Append(',');
|
||||
if (!FindInReadable(commaSeparated, start, end)) {
|
||||
catMan->AddCategoryEntry("Gecko-Content-Viewers",
|
||||
mMimeTypeArray[i],
|
||||
mMimeTypes[i].get(),
|
||||
contractId,
|
||||
PR_FALSE, /* persist: broken by bug 193031 */
|
||||
aOverrideInternalTypes, /* replace if we're told to */
|
||||
|
@ -498,7 +447,7 @@ nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
|
|||
|
||||
PLUGIN_LOG(PLUGIN_LOG_NOISY,
|
||||
("nsPluginTag::RegisterWithCategoryManager mime=%s, plugin=%s\n",
|
||||
mMimeTypeArray[i], mFileName.get()));
|
||||
mMimeTypes[i].get(), mFileName.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,15 +498,16 @@ PRBool nsPluginTag::Equals(nsPluginTag *aPluginTag)
|
|||
|
||||
if ((!mName.Equals(aPluginTag->mName)) ||
|
||||
(!mDescription.Equals(aPluginTag->mDescription)) ||
|
||||
(mVariants != aPluginTag->mVariants))
|
||||
(mMimeTypes.Length() != aPluginTag->mMimeTypes.Length())) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (mVariants && mMimeTypeArray && aPluginTag->mMimeTypeArray) {
|
||||
for (PRInt32 i = 0; i < mVariants; i++) {
|
||||
if (PL_strcmp(mMimeTypeArray[i], aPluginTag->mMimeTypeArray[i]) != 0)
|
||||
for (PRUint32 i = 0; i < mMimeTypes.Length(); i++) {
|
||||
if (!mMimeTypes[i].Equals(aPluginTag->mMimeTypes[i])) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -586,33 +536,3 @@ void nsPluginTag::TryUnloadPlugin()
|
|||
RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginUnregister);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginTag::RemoveJavaSentinel(PRInt32 sentinelIndex)
|
||||
{
|
||||
if (sentinelIndex == -1)
|
||||
return;
|
||||
|
||||
delete[] mMimeTypeArray[sentinelIndex];
|
||||
mMimeDescriptionArray.RemoveElementAt(sentinelIndex);
|
||||
if (mExtensionsArray)
|
||||
delete[] mExtensionsArray[sentinelIndex];
|
||||
|
||||
// Move the subsequent entries in the arrays.
|
||||
if (mVariants > sentinelIndex + 1) {
|
||||
memmove(mMimeTypeArray + sentinelIndex,
|
||||
mMimeTypeArray + sentinelIndex + 1,
|
||||
(mVariants - sentinelIndex - 1) * sizeof(mMimeTypeArray[0]));
|
||||
|
||||
if (mExtensionsArray) {
|
||||
memmove(mExtensionsArray + sentinelIndex,
|
||||
mExtensionsArray + sentinelIndex + 1,
|
||||
(mVariants - sentinelIndex - 1) * sizeof(mExtensionsArray[0]));
|
||||
}
|
||||
}
|
||||
--mVariants;
|
||||
|
||||
mMimeTypeArray[mVariants] = NULL;
|
||||
if (mExtensionsArray)
|
||||
mExtensionsArray[mVariants] = NULL;
|
||||
}
|
||||
|
|
|
@ -101,19 +101,13 @@ public:
|
|||
void RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
|
||||
nsRegisterType aType = ePluginRegister);
|
||||
|
||||
// Remove the MIME/description/extension entry associated with the magic Java sentinel
|
||||
// which informs us that the Java plugin is NPAPI-enabled. If sentinelIndex is -1, no
|
||||
// action will be performed.
|
||||
void RemoveJavaSentinel(PRInt32 sentinelIndex);
|
||||
|
||||
nsRefPtr<nsPluginTag> mNext;
|
||||
nsPluginHost *mPluginHost;
|
||||
nsCString mName; // UTF-8
|
||||
nsCString mDescription; // UTF-8
|
||||
PRInt32 mVariants;
|
||||
char **mMimeTypeArray;
|
||||
nsTArray<nsCString> mMimeDescriptionArray; // UTF-8
|
||||
char **mExtensionsArray;
|
||||
nsTArray<nsCString> mMimeTypes; // UTF-8
|
||||
nsTArray<nsCString> mMimeDescriptions; // UTF-8
|
||||
nsTArray<nsCString> mExtensions; // UTF-8
|
||||
PRLibrary *mLibrary;
|
||||
nsRefPtr<nsNPAPIPlugin> mEntryPoint;
|
||||
PRPackedBool mCanUnloadLibrary;
|
||||
|
|
|
@ -265,7 +265,7 @@ public:
|
|||
nsresult status;
|
||||
nsresult statusResult;
|
||||
|
||||
PRInt32 readyState;
|
||||
PRUint16 readyState;
|
||||
nsresult readyStateResult;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -720,7 +720,7 @@ nsDOMWorkerXHR::SetRequestHeader(const nsACString& aHeader,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHR::GetReadyState(PRInt32* aReadyState)
|
||||
nsDOMWorkerXHR::GetReadyState(PRUint16* aReadyState)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
|
@ -902,9 +902,21 @@ nsDOMWorkerXHR::SetWithCredentials(PRBool aWithCredentials)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute jsval (ArrayBuffer) mozResponseArrayBuffer; */
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHR::GetMozResponseArrayBuffer(jsval *aResult)
|
||||
nsDOMWorkerXHR::GetMozResponseType(nsAString& aResponseText)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHR::SetMozResponseType(const nsAString& aResponseText)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute jsval response; */
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHR::GetMozResponse(JSContext *aCx, jsval *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -1090,7 +1090,7 @@ nsDOMWorkerXHRProxy::GetStatus(nsresult* _retval)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsDOMWorkerXHRProxy::GetReadyState(PRInt32* _retval)
|
||||
nsDOMWorkerXHRProxy::GetReadyState(PRUint16* _retval)
|
||||
{
|
||||
NS_ASSERTION(_retval, "Null pointer!");
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ protected:
|
|||
nsresult GetResponseText(nsAString& _retval);
|
||||
nsresult GetStatusText(nsACString& _retval);
|
||||
nsresult GetStatus(nsresult* _retval);
|
||||
nsresult GetReadyState(PRInt32* _retval);
|
||||
nsresult GetReadyState(PRUint16* _retval);
|
||||
nsresult SetRequestHeader(const nsACString& aHeader,
|
||||
const nsACString& aValue);
|
||||
nsresult OverrideMimeType(const nsACString& aMimetype);
|
||||
|
|
|
@ -138,6 +138,7 @@ _TEST_FILES = \
|
|||
test_bug633133.html \
|
||||
test_bug642026.html \
|
||||
test_bug648465.html \
|
||||
test_bug654137.html \
|
||||
test_window_bar.html \
|
||||
file_window_bar.html \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=654137
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 654137</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=654137">Mozilla Bug 654137</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 654137 **/
|
||||
var prev = window.top;
|
||||
top = "Fail";
|
||||
is(top, prev, "top should not have been replaced");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -86,11 +86,6 @@ nsBaseComposerCommand::nsBaseComposerCommand()
|
|||
NS_IMPL_ISUPPORTS1(nsBaseComposerCommand, nsIControllerCommand)
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
nsBaseStateUpdatingCommand::nsBaseStateUpdatingCommand(const char* aTagName)
|
||||
: nsBaseComposerCommand()
|
||||
, mTagName(aTagName)
|
||||
|
@ -197,10 +192,6 @@ nsPasteNoFormattingCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED, enabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsStyleUpdatingCommand::nsStyleUpdatingCommand(const char* aTagName)
|
||||
: nsBaseStateUpdatingCommand(aTagName)
|
||||
{
|
||||
|
@ -293,9 +284,6 @@ nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
|
|||
|
||||
return rv;
|
||||
}
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsListCommand::nsListCommand(const char* aTagName)
|
||||
: nsBaseStateUpdatingCommand(aTagName)
|
||||
|
@ -351,10 +339,6 @@ nsListCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsListItemCommand::nsListItemCommand(const char* aTagName)
|
||||
: nsBaseStateUpdatingCommand(aTagName)
|
||||
{
|
||||
|
@ -435,10 +419,6 @@ nsListItemCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRemoveListCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -497,10 +477,6 @@ nsRemoveListCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIndentCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon, PRBool *outCmdEnabled)
|
||||
|
@ -593,11 +569,6 @@ nsOutdentCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
nsMultiStateCommand::nsMultiStateCommand()
|
||||
: nsBaseComposerCommand()
|
||||
{
|
||||
|
@ -673,10 +644,6 @@ nsMultiStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsParagraphStateCommand::nsParagraphStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -715,10 +682,6 @@ nsParagraphStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return htmlEditor->SetParagraphFormat(newState);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsFontFaceStateCommand::nsFontFaceStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -779,10 +742,6 @@ nsFontFaceStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsFontSizeStateCommand::nsFontSizeStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -859,9 +818,6 @@ nsFontSizeStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
nsFontColorStateCommand::nsFontColorStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -909,10 +865,6 @@ nsFontColorStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsHighlightColorStateCommand::nsHighlightColorStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -971,10 +923,6 @@ nsHighlightColorStateCommand::IsCommandEnabled(const char * aCommandName,
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsBackgroundColorStateCommand::nsBackgroundColorStateCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -1013,10 +961,6 @@ nsBackgroundColorStateCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return htmlEditor->SetBackgroundColor(newState);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsAlignCommand::nsAlignCommand()
|
||||
: nsMultiStateCommand()
|
||||
{
|
||||
|
@ -1074,12 +1018,6 @@ nsAlignCommand::SetState(nsIEditor *aEditor, nsString& newState)
|
|||
return htmlEditor->Align(newState);
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
nsAbsolutePositioningCommand::nsAbsolutePositioningCommand()
|
||||
: nsBaseStateUpdatingCommand("")
|
||||
{
|
||||
|
@ -1151,10 +1089,6 @@ nsAbsolutePositioningCommand::ToggleState(nsIEditor *aEditor, const char* aTagNa
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDecreaseZIndexCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -1212,10 +1146,6 @@ nsDecreaseZIndexCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED, enabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIncreaseZIndexCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -1266,10 +1196,6 @@ nsIncreaseZIndexCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED, enabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRemoveStylesCommand::IsCommandEnabled(const char * aCommandName,
|
||||
|
@ -1317,10 +1243,6 @@ nsRemoveStylesCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIncreaseFontSizeCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -1366,10 +1288,6 @@ nsIncreaseFontSizeCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDecreaseFontSizeCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -1415,10 +1333,6 @@ nsDecreaseFontSizeCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInsertHTMLCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
@ -1472,10 +1386,6 @@ nsInsertHTMLCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsInsertTagCommand, nsBaseComposerCommand)
|
||||
|
||||
nsInsertTagCommand::nsInsertTagCommand(const char* aTagName)
|
||||
|
@ -1584,9 +1494,6 @@ nsInsertTagCommand::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
/****************************/
|
||||
//HELPER METHODS
|
||||
|
|
|
@ -448,10 +448,6 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentStateCommand::IsCommandEnabled(const char* aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
|
|
@ -641,10 +641,6 @@ nsEditingSession::GetEditorForWindow(nsIDOMWindow *aWindow,
|
|||
return editorDocShell->GetEditor(outEditor);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
OnStateChange
|
||||
|
@ -894,11 +890,6 @@ nsEditingSession::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
IsProgressForTargetDocument
|
||||
|
@ -1149,11 +1140,6 @@ nsEditingSession::EndPageLoad(nsIWebProgress *aWebProgress,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
GetDocShellFromWindow
|
||||
|
|
|
@ -157,6 +157,7 @@ EDITOR_ATOM(ol, "ol")
|
|||
EDITOR_ATOM(output, "output")
|
||||
EDITOR_ATOM(p, "p")
|
||||
EDITOR_ATOM(pre, "pre")
|
||||
EDITOR_ATOM(progress, "progress")
|
||||
EDITOR_ATOM(q, "q")
|
||||
EDITOR_ATOM(samp, "samp")
|
||||
EDITOR_ATOM(script, "script")
|
||||
|
|
|
@ -215,12 +215,6 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsEditor)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsEditor)
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditorMethods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags)
|
||||
|
@ -1339,12 +1333,6 @@ NS_IMETHODIMP nsEditor::SetSpellcheckUserOverride(PRBool enable)
|
|||
return SyncRealTimeSpell();
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark main node manipulation routines
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsEditor::CreateNode(const nsAString& aTag,
|
||||
nsIDOMNode * aParent,
|
||||
PRInt32 aPosition,
|
||||
|
@ -1702,11 +1690,6 @@ nsEditor::MoveNode(nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aOffset)
|
|||
return InsertNode(aNode, aParent, aOffset);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark editor observer maintainance
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::AddEditorObserver(nsIEditorObserver *aObserver)
|
||||
|
@ -1744,11 +1727,6 @@ void nsEditor::NotifyEditorObservers(void)
|
|||
mEditorObservers[i]->EditAction();
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark action listener maintainance
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::AddEditActionListener(nsIEditActionListener *aListener)
|
||||
|
@ -1778,13 +1756,6 @@ nsEditor::RemoveEditActionListener(nsIEditActionListener *aListener)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark docstate listener maintainance
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::AddDocumentStateListener(nsIDocumentStateListener *aListener)
|
||||
{
|
||||
|
@ -1812,12 +1783,6 @@ nsEditor::RemoveDocumentStateListener(nsIDocumentStateListener *aListener)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark misc
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsEditor::OutputToString(const nsAString& aFormatType,
|
||||
PRUint32 aFlags,
|
||||
nsAString& aOutputString)
|
||||
|
@ -1873,11 +1838,6 @@ nsEditor::DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark support for selection preservation
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
PRBool
|
||||
nsEditor::ArePreservingSelection()
|
||||
|
@ -1910,12 +1870,6 @@ nsEditor::StopPreservingSelection()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark IME event handlers
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsEditor::BeginIMEComposition()
|
||||
{
|
||||
|
@ -1961,13 +1915,6 @@ nsEditor::EndIMEComposition()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIPhonetic
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetPhonetic(nsAString& aPhonetic)
|
||||
{
|
||||
|
@ -1980,13 +1927,6 @@ nsEditor::GetPhonetic(nsAString& aPhonetic)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditorIMESupport
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
static nsresult
|
||||
GetEditorContentWindow(nsIDOMElement *aRoot, nsIWidget **aResult)
|
||||
{
|
||||
|
@ -2035,7 +1975,7 @@ nsEditor::ForceCompositionEnd()
|
|||
// flag for Unix.
|
||||
// We should use nsILookAndFeel to resolve this
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2)
|
||||
// XXXmnakano see bug 558976, ResetInputState() has two meaning which are
|
||||
// "commit the composition" and "cursor is moved". This method name is
|
||||
// "ForceCompositionEnd", so, ResetInputState() should be used only for the
|
||||
|
@ -2104,13 +2044,8 @@ nsEditor::GetComposing(PRBool* aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark public nsEditor methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
/* Non-interface, public methods */
|
||||
|
||||
/* Non-interface, public methods */
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetRootElement(nsIDOMElement **aRootElement)
|
||||
|
@ -2274,11 +2209,6 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark Protected and static methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsEditor::ScrollSelectionIntoView(PRBool aScrollToAnchor)
|
||||
{
|
||||
|
@ -2761,11 +2691,6 @@ NS_IMETHODIMP nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
|
|||
|
||||
// END nsEditor core implementation
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsEditor public static helper methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
// BEGIN nsEditor public helper methods
|
||||
|
||||
|
@ -4271,13 +4196,6 @@ nsEditor::GetShouldTxnSetSelection()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark protected nsEditor methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DeleteSelectionImpl(nsIEditor::EDirection aAction)
|
||||
{
|
||||
|
|
|
@ -60,10 +60,6 @@ nsBaseEditorCommand::nsBaseEditorCommand()
|
|||
|
||||
NS_IMPL_ISUPPORTS1(nsBaseEditorCommand, nsIControllerCommand)
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUndoCommand::IsCommandEnabled(const char * aCommandName,
|
||||
|
@ -790,9 +786,6 @@ nsSelectionMoveCommands::GetCommandStateParams(const char *aCommandName,
|
|||
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInsertPlaintextCommand::IsCommandEnabled(const char * aCommandName,
|
||||
|
@ -850,10 +843,6 @@ nsInsertPlaintextCommand::GetCommandStateParams(const char *aCommandName,
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPasteQuotationCommand::IsCommandEnabled(const char * aCommandName,
|
||||
nsISupports *refCon,
|
||||
|
|
|
@ -128,10 +128,6 @@ AddStyleSheetTxn::GetTxnDescription(nsAString& aString)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
RemoveStyleSheetTxn::RemoveStyleSheetTxn()
|
||||
: EditTxn()
|
||||
|
|
|
@ -1570,7 +1570,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
|||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aDropEvent));
|
||||
if (mouseEvent)
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
mouseEvent->GetAltKey(&userWantsCopy);
|
||||
#else
|
||||
mouseEvent->GetCtrlKey(&userWantsCopy);
|
||||
|
|
|
@ -40,11 +40,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* build on macs with low memory */
|
||||
#if defined(XP_MAC) && defined(MOZ_MAC_LOWMEM)
|
||||
#pragma optimization_level 1
|
||||
#endif
|
||||
|
||||
#include "nsHTMLEditRules.h"
|
||||
|
||||
#include "nsEditor.h"
|
||||
|
@ -8401,12 +8396,6 @@ nsHTMLEditRules::InsertMozBRIfNeeded(nsIDOMNode *aNode)
|
|||
return res;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditActionListener methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditRules::WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, PRInt32 aPosition)
|
||||
{
|
||||
|
|
|
@ -433,6 +433,7 @@ nsHTMLEditUtils::IsFormWidget(nsIDOMNode *node)
|
|||
|| (nodeAtom == nsEditProperty::button)
|
||||
|| (nodeAtom == nsEditProperty::output)
|
||||
|| (nodeAtom == nsEditProperty::keygen)
|
||||
|| (nodeAtom == nsEditProperty::progress)
|
||||
|| (nodeAtom == nsEditProperty::input);
|
||||
}
|
||||
|
||||
|
@ -484,8 +485,8 @@ nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode * aNode)
|
|||
// strong, var
|
||||
#define GROUP_PHRASE (1 << 4)
|
||||
|
||||
// a, applet, basefont, bdo, br, font, iframe, img, map, object, output, q,
|
||||
// script, span, sub, sup
|
||||
// a, applet, basefont, bdo, br, font, iframe, img, map, object, output,
|
||||
// progress, q, script, span, sub, sup
|
||||
#define GROUP_SPECIAL (1 << 5)
|
||||
|
||||
// button, form, input, label, select, textarea
|
||||
|
@ -683,6 +684,7 @@ static const nsElementInfo kElements[eHTMLTag_userdefined] = {
|
|||
ELEM(param, PR_FALSE, PR_FALSE, GROUP_OBJECT_CONTENT, GROUP_NONE),
|
||||
ELEM(plaintext, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
|
||||
ELEM(pre, PR_TRUE, PR_TRUE, GROUP_BLOCK, GROUP_INLINE_ELEMENT),
|
||||
ELEM(progress, PR_TRUE, PR_FALSE, GROUP_SPECIAL, GROUP_FLOW_ELEMENT),
|
||||
ELEM(q, PR_TRUE, PR_TRUE, GROUP_SPECIAL, GROUP_INLINE_ELEMENT),
|
||||
ELEM(s, PR_TRUE, PR_TRUE, GROUP_FONTSTYLE, GROUP_INLINE_ELEMENT),
|
||||
ELEM(samp, PR_TRUE, PR_TRUE, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
|
||||
|
|
|
@ -1393,12 +1393,6 @@ PRBool nsHTMLEditor::IsModifiable()
|
|||
return !IsReadonly();
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIHTMLEditor methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::UpdateBaseURL()
|
||||
{
|
||||
|
@ -3484,11 +3478,6 @@ nsHTMLEditor::GetLinkedObjects(nsISupportsArray** aNodeList)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditorStyleSheets methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::AddStyleSheet(const nsAString &aURL)
|
||||
|
@ -3810,12 +3799,6 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditor overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::DeleteNode(nsIDOMNode * aNode)
|
||||
{
|
||||
// do nothing if the node is read-only
|
||||
|
@ -3863,12 +3846,6 @@ NS_IMETHODIMP nsHTMLEditor::InsertTextImpl(const nsAString& aStringToInsert,
|
|||
return nsEditor::InsertTextImpl(aStringToInsert, aInOutNode, aInOutOffset, aDoc);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsStubMutationObserver overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
void
|
||||
nsHTMLEditor::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
|
@ -3922,11 +3899,6 @@ nsHTMLEditor::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark support utils
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
/* This routine examines aNode and it's ancestors looking for any node which has the
|
||||
-moz-user-select: all style lit. Return the highest such ancestor. */
|
||||
|
@ -4071,12 +4043,6 @@ nsHTMLEditor::DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark StyleSheet utils
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
|
@ -4114,12 +4080,6 @@ nsHTMLEditor::StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsEditor overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
/** All editor operations which alter the doc should be prefaced
|
||||
* with a call to StartOperation, naming the action and direction */
|
||||
|
@ -4265,12 +4225,6 @@ nsHTMLEditor::SelectAll()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark Random methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
// this will NOT find aAttribute unless aAttribute has a non-null value
|
||||
// so singleton attributes like <Table border> will not be matched!
|
||||
void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
|
||||
|
@ -4340,9 +4294,6 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
//================================================================
|
||||
// HTML Editor methods
|
||||
|
@ -4447,9 +4398,6 @@ nsHTMLEditor::GetEnclosingTable(nsIDOMNode *aNode)
|
|||
return tbl;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
#ifdef PRE_NODE_IN_BODY
|
||||
nsCOMPtr<nsIDOMElement> nsHTMLEditor::FindPreElement()
|
||||
|
@ -4552,9 +4500,6 @@ nsHTMLEditor::SetSelectionAtDocumentStart(nsISelection *aSelection)
|
|||
return aSelection->Collapse(rootElement,0);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// RemoveBlockContainer: remove inNode, reparenting it's children into their
|
||||
|
|
|
@ -136,7 +136,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
PRBool isContextClick;
|
||||
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
// Ctrl+Click for context menu
|
||||
res = mouseEvent->GetCtrlKey(&isContextClick);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
|
|
@ -418,12 +418,6 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
|||
return TypedText(str, eTypedText);
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIHTMLEditor methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
/* This routine is needed to provide a bottleneck for typing for logging
|
||||
purposes. Can't use HandleKeyPress() (above) for that since it takes
|
||||
a nsIDOMKeyEvent* parameter. So instead we pass enough info through
|
||||
|
@ -1207,12 +1201,6 @@ nsPlaintextEditor::SetNewlineHandling(PRInt32 aNewlineHandling)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditor overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::Undo(PRUint32 aCount)
|
||||
{
|
||||
|
@ -1457,13 +1445,6 @@ nsPlaintextEditor::OutputToStream(nsIOutputStream* aOutputStream,
|
|||
return encoder->EncodeToStream(aOutputStream);
|
||||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsIEditorMailSupport overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaintextEditor::InsertTextWithQuotations(const nsAString &aStringToInsert)
|
||||
{
|
||||
|
@ -1673,13 +1654,6 @@ nsPlaintextEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark nsEditor overrides
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
/** All editor operations which alter the doc should be prefaced
|
||||
* with a call to StartOperation, naming the action and direction */
|
||||
NS_IMETHODIMP
|
||||
|
@ -1741,13 +1715,6 @@ nsPlaintextEditor::GetPIDOMEventTarget()
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#pragma mark Random methods
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsPlaintextEditor::SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
||||
const nsAString & aAttribute,
|
||||
|
|
|
@ -637,7 +637,9 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
|||
nsresult res = TruncateInsertionIfNeeded(aSelection, inString, outString,
|
||||
aMaxLength, &truncated);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (truncated && outString->IsEmpty()) {
|
||||
// If we're exceeding the maxlength when composing IME, we need to clean up
|
||||
// the composing text, so we shouldn't return early.
|
||||
if (truncated && outString->IsEmpty() && aAction != kInsertTextIME) {
|
||||
*aCancel = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3821,11 +3821,7 @@ nsTextServicesDocument::NodeHasOffsetEntry(nsTArray<OffsetEntry*> *aOffsetTable,
|
|||
}
|
||||
|
||||
// Spellchecker code has this. See bug 211343
|
||||
#ifdef XP_MAC
|
||||
#define IS_NBSP_CHAR(c) (((unsigned char)0xca)==(c))
|
||||
#else
|
||||
#define IS_NBSP_CHAR(c) (((unsigned char)0xa0)==(c))
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsTextServicesDocument::FindWordBounds(nsTArray<OffsetEntry*> *aOffsetTable,
|
||||
|
|
|
@ -206,6 +206,10 @@ abstract public class GeckoApp
|
|||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT));
|
||||
|
||||
mConnectivityFilter = new IntentFilter();
|
||||
mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
mConnectivityReceiver = new GeckoConnectivityReceiver();
|
||||
|
||||
if (!checkAndSetLaunchState(LaunchState.PreLaunch,
|
||||
LaunchState.Launching))
|
||||
return;
|
||||
|
@ -255,10 +259,6 @@ abstract public class GeckoApp
|
|||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
mConnectivityFilter = new IntentFilter();
|
||||
mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
mConnectivityReceiver = new GeckoConnectivityReceiver();
|
||||
}
|
||||
|
||||
boolean IsNewInstall() {
|
||||
|
|
|
@ -74,7 +74,7 @@ endif
|
|||
|
||||
DEFINES += \
|
||||
-DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
|
||||
-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
|
||||
-DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \
|
||||
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
|
||||
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
|
||||
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
|
||||
|
|
|
@ -1027,11 +1027,6 @@ nsDocShellTreeOwner::GetOwnerRequestor()
|
|||
}
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// DefaultTooltipTextProvider
|
||||
|
||||
|
@ -1651,12 +1646,6 @@ ChromeTooltipListener::sAutoHideCallback(nsITimer *aTimer, void* aListener)
|
|||
} // sAutoHideCallback
|
||||
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(ChromeContextMenuListener)
|
||||
NS_IMPL_RELEASE(ChromeContextMenuListener)
|
||||
|
||||
|
|
|
@ -275,10 +275,6 @@ nsCommandManager::DoCommand(const char *aCommandName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsCommandManager::IsCallerChrome(PRBool *is_caller_chrome)
|
||||
{
|
||||
|
|
|
@ -215,12 +215,7 @@ struct CleanupData
|
|||
// volume / server dependent but it is difficult to obtain
|
||||
// that information. Instead this constant is a reasonable value that
|
||||
// modern systems should able to cope with.
|
||||
|
||||
#ifdef XP_MAC
|
||||
const PRUint32 kDefaultMaxFilenameLength = 31;
|
||||
#else
|
||||
const PRUint32 kDefaultMaxFilenameLength = 64;
|
||||
#endif
|
||||
|
||||
// Default flags for persistence
|
||||
const PRUint32 kDefaultPersistFlags =
|
||||
|
|
|
@ -281,9 +281,6 @@ nsresult nsReadConfig::openAndEvaluateJSFile(const char *aFileName, PRInt32 obsc
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
#ifdef XP_MAC
|
||||
jsFile->AppendNative(NS_LITERAL_CSTRING("Essential Files"));
|
||||
#endif
|
||||
rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
// qcms
|
||||
// Copyright (C) 2009 Mozilla Foundation
|
||||
// Copyright (C) 1998-2007 Marti Maria
|
||||
|
@ -20,7 +19,6 @@
|
|||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -94,7 +94,7 @@ typedef enum {
|
|||
QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3
|
||||
} qcms_intent;
|
||||
|
||||
/* XXX: I don't really like the _DATA_ prefix */
|
||||
//XXX: I don't really like the _DATA_ prefix
|
||||
typedef enum {
|
||||
QCMS_DATA_RGB_8,
|
||||
QCMS_DATA_RGBA_8,
|
||||
|
|
|
@ -113,7 +113,7 @@ struct tag_value {
|
|||
} XYZNumber;
|
||||
} XYZType;
|
||||
};
|
||||
}; /* I guess we need to pack this? */
|
||||
}; // I guess we need to pack this?
|
||||
#endif
|
||||
|
||||
#define RGB_SIGNATURE 0x52474220
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef PRUptrdiff uintptr_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#else /* MOZ_QCMS */
|
||||
#else // MOZ_QCMS
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define IS_LITTLE_ENDIAN
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
// qcms
|
||||
// Copyright (C) 2009 Mozilla Corporation
|
||||
// Copyright (C) 1998-2007 Marti Maria
|
||||
|
@ -20,7 +19,6 @@
|
|||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
@ -660,10 +658,10 @@ static uint16_t *build_pow_table(float gamma, int length)
|
|||
|
||||
static float clamp_float(float a)
|
||||
{
|
||||
if (a > 1.)
|
||||
return 1.;
|
||||
else if (a < 0)
|
||||
return 0;
|
||||
if (a > 1.f)
|
||||
return 1.f;
|
||||
else if (a < 0.f)
|
||||
return 0.f;
|
||||
else
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -57,9 +57,51 @@
|
|||
|
||||
#include "qcms.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
// cribbed from CTFontManager.h
|
||||
enum {
|
||||
kAutoActivationDisabled = 1
|
||||
};
|
||||
typedef uint32_t AutoActivationSetting;
|
||||
|
||||
// bug 567552 - disable auto-activation of fonts
|
||||
|
||||
static void
|
||||
DisableFontActivation()
|
||||
{
|
||||
// get the main bundle identifier
|
||||
CFBundleRef mainBundle = ::CFBundleGetMainBundle();
|
||||
CFStringRef mainBundleID = NULL;
|
||||
|
||||
if (mainBundle) {
|
||||
mainBundleID = ::CFBundleGetIdentifier(mainBundle);
|
||||
}
|
||||
|
||||
// if possible, fetch CTFontManagerSetAutoActivationSetting
|
||||
void (*CTFontManagerSetAutoActivationSettingPtr)
|
||||
(CFStringRef, AutoActivationSetting);
|
||||
CTFontManagerSetAutoActivationSettingPtr =
|
||||
(void (*)(CFStringRef, AutoActivationSetting))
|
||||
dlsym(RTLD_DEFAULT, "CTFontManagerSetAutoActivationSetting");
|
||||
|
||||
// bug 567552 - disable auto-activation of fonts
|
||||
if (CTFontManagerSetAutoActivationSettingPtr) {
|
||||
CTFontManagerSetAutoActivationSettingPtr(mainBundleID,
|
||||
kAutoActivationDisabled);
|
||||
}
|
||||
|
||||
::CFRelease(mainBundleID);
|
||||
::CFRelease(mainBundle);
|
||||
}
|
||||
|
||||
gfxPlatformMac::gfxPlatformMac()
|
||||
{
|
||||
mOSXVersion = 0;
|
||||
OSXVersion();
|
||||
if (mOSXVersion >= MAC_OS_X_VERSION_10_6_HEX) {
|
||||
DisableFontActivation();
|
||||
}
|
||||
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
|
||||
}
|
||||
|
||||
|
|
|
@ -785,6 +785,97 @@ gfxWindowsPlatform::GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion
|
|||
aVersion.Assign(NS_ConvertUTF8toUTF16(buf));
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams)
|
||||
{
|
||||
HKEY hKey, subKey;
|
||||
DWORD i, rv, size, type;
|
||||
WCHAR displayName[256], subkeyName[256];
|
||||
|
||||
aParams.Clear();
|
||||
|
||||
// construct subkeys based on HKLM subkeys, assume they are same for HKCU
|
||||
rv = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"Software\\Microsoft\\Avalon.Graphics",
|
||||
0, KEY_READ, &hKey);
|
||||
|
||||
if (rv != ERROR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// enumerate over subkeys
|
||||
for (i = 0, rv = ERROR_SUCCESS; rv != ERROR_NO_MORE_ITEMS; i++) {
|
||||
size = NS_ARRAY_LENGTH(displayName);
|
||||
rv = RegEnumKeyExW(hKey, i, displayName, &size, NULL, NULL, NULL, NULL);
|
||||
if (rv != ERROR_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ClearTypeParameterInfo ctinfo;
|
||||
ctinfo.displayName.Assign(displayName);
|
||||
|
||||
DWORD subrv, value;
|
||||
bool foundData = false;
|
||||
|
||||
swprintf_s(subkeyName, NS_ARRAY_LENGTH(subkeyName),
|
||||
L"Software\\Microsoft\\Avalon.Graphics\\%s", displayName);
|
||||
|
||||
// subkey for gamma, pixel structure
|
||||
subrv = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
subkeyName, 0, KEY_QUERY_VALUE, &subKey);
|
||||
|
||||
if (subrv == ERROR_SUCCESS) {
|
||||
size = sizeof(value);
|
||||
subrv = RegQueryValueExW(subKey, L"GammaLevel", NULL, &type,
|
||||
(LPBYTE)&value, &size);
|
||||
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
|
||||
foundData = true;
|
||||
ctinfo.gamma = value;
|
||||
}
|
||||
|
||||
size = sizeof(value);
|
||||
subrv = RegQueryValueExW(subKey, L"PixelStructure", NULL, &type,
|
||||
(LPBYTE)&value, &size);
|
||||
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
|
||||
foundData = true;
|
||||
ctinfo.pixelStructure = value;
|
||||
}
|
||||
|
||||
RegCloseKey(subKey);
|
||||
}
|
||||
|
||||
// subkey for cleartype level, enhanced contrast
|
||||
subrv = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||
subkeyName, 0, KEY_QUERY_VALUE, &subKey);
|
||||
|
||||
if (subrv == ERROR_SUCCESS) {
|
||||
size = sizeof(value);
|
||||
subrv = RegQueryValueExW(subKey, L"ClearTypeLevel", NULL, &type,
|
||||
(LPBYTE)&value, &size);
|
||||
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
|
||||
foundData = true;
|
||||
ctinfo.clearTypeLevel = value;
|
||||
}
|
||||
|
||||
size = sizeof(value);
|
||||
subrv = RegQueryValueExW(subKey, L"EnhancedContrastLevel",
|
||||
NULL, &type, (LPBYTE)&value, &size);
|
||||
if (subrv == ERROR_SUCCESS && type == REG_DWORD) {
|
||||
foundData = true;
|
||||
ctinfo.enhancedContrast = value;
|
||||
}
|
||||
|
||||
RegCloseKey(subKey);
|
||||
}
|
||||
|
||||
if (foundData) {
|
||||
aParams.AppendElement(ctinfo);
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
|
||||
{
|
||||
|
@ -830,19 +921,19 @@ gfxWindowsPlatform::SetupClearTypeParams(nsIPrefBranch *aPrefBranch)
|
|||
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_GAMMA,
|
||||
&value))) {
|
||||
if (value >= 1000 && value <= 2200) {
|
||||
gamma = (FLOAT)value / 1000.0;
|
||||
gamma = FLOAT(value / 1000.0);
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_CONTRAST,
|
||||
&value))) {
|
||||
if (value >= 0 && value <= 1000) {
|
||||
contrast = (FLOAT)value / 100.0;
|
||||
contrast = FLOAT(value / 100.0);
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_LEVEL,
|
||||
&value))) {
|
||||
if (value >= 0 && value <= 100) {
|
||||
level = (FLOAT)value / 100.0;
|
||||
level = FLOAT(value / 100.0);
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_STRUCTURE,
|
||||
|
|
|
@ -114,6 +114,19 @@ struct DCFromContext {
|
|||
PRBool needsRelease;
|
||||
};
|
||||
|
||||
// ClearType parameters set by running ClearType tuner
|
||||
struct ClearTypeParameterInfo {
|
||||
ClearTypeParameterInfo() :
|
||||
gamma(-1), pixelStructure(-1), clearTypeLevel(-1), enhancedContrast(-1)
|
||||
{ }
|
||||
|
||||
nsString displayName; // typically just 'DISPLAY1'
|
||||
PRInt32 gamma;
|
||||
PRInt32 pixelStructure;
|
||||
PRInt32 clearTypeLevel;
|
||||
PRInt32 enhancedContrast;
|
||||
};
|
||||
|
||||
class THEBES_API gfxWindowsPlatform : public gfxPlatform {
|
||||
public:
|
||||
gfxWindowsPlatform();
|
||||
|
@ -236,6 +249,9 @@ public:
|
|||
|
||||
static void GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion);
|
||||
|
||||
// returns ClearType tuning information for each display
|
||||
static void GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams);
|
||||
|
||||
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
|
||||
|
||||
void SetupClearTypeParams(nsIPrefBranch *aPrefBranch);
|
||||
|
|
|
@ -101,7 +101,6 @@ NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
|
||||
#endif
|
||||
#ifdef USE_MAC_LOCALE
|
||||
NS_DEFINE_NAMED_CID(NS_MACLOCALE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
|
||||
#endif
|
||||
|
@ -138,7 +137,6 @@ static const mozilla::Module::CIDEntry kIntlCIDs[] = {
|
|||
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatUnixConstructor },
|
||||
#endif
|
||||
#ifdef USE_MAC_LOCALE
|
||||
{ &kNS_MACLOCALE_CID, false, NULL, nsMacLocaleConstructor },
|
||||
{ &kNS_COLLATION_CID, false, NULL, nsCollationMacUCConstructor },
|
||||
{ &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatMacConstructor },
|
||||
#endif
|
||||
|
@ -177,7 +175,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
|
|||
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
|
||||
#endif
|
||||
#ifdef USE_MAC_LOCALE
|
||||
{ NS_MACLOCALE_CONTRACTID, &kNS_MACLOCALE_CID },
|
||||
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
|
||||
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
|
||||
#endif
|
||||
|
|
|
@ -49,7 +49,6 @@ EXPORTS = \
|
|||
nsDateTimeFormatCID.h \
|
||||
nsIDateTimeFormat.h \
|
||||
nsILanguageAtomService.h \
|
||||
nsIMacLocale.h \
|
||||
nsIPosixLocale.h \
|
||||
nsIOS2Locale.h \
|
||||
nsWin32Locale.h \
|
||||
|
|
|
@ -51,7 +51,6 @@ LIBXUL_LIBRARY = 1
|
|||
CPPSRCS = \
|
||||
nsCollationMacUC.cpp \
|
||||
nsDateTimeFormatMac.cpp \
|
||||
nsMacLocale.cpp \
|
||||
nsMacCharset.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsDateTimeFormatMac.h"
|
||||
#include <CoreFoundation/CFDateFormatter.h>
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsIMacLocale.h"
|
||||
#include "nsCRT.h"
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "pratom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIMacLocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsPlatformCharset.h"
|
||||
|
|
|
@ -1,326 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsMacLocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "prprf.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXPCOMStrings.h"
|
||||
|
||||
struct iso_lang_map
|
||||
{
|
||||
const char* iso_code;
|
||||
short mac_lang_code;
|
||||
short mac_script_code;
|
||||
|
||||
};
|
||||
typedef struct iso_lang_map iso_lang_map;
|
||||
|
||||
const iso_lang_map lang_list[] = {
|
||||
{ "sq", langAlbanian, smRoman },
|
||||
{ "am", langAmharic, smEthiopic },
|
||||
{ "ar", langArabic, smArabic },
|
||||
{ "hy", langArmenian, smArmenian},
|
||||
{ "as", langAssamese, smBengali },
|
||||
{ "ay", langAymara, smRoman},
|
||||
{ "eu", langBasque, smRoman},
|
||||
{ "bn", langBengali, smBengali },
|
||||
{ "dz", langDzongkha, smTibetan },
|
||||
{ "br", langBreton, smRoman },
|
||||
{ "bg", langBulgarian, smCyrillic },
|
||||
{ "my", langBurmese, smBurmese },
|
||||
{ "km", langKhmer, smKhmer },
|
||||
{ "ca", langCatalan, smRoman },
|
||||
{ "zh", langTradChinese, smTradChinese },
|
||||
{ "hr", langCroatian, smRoman },
|
||||
{ "cs", langCzech, smCentralEuroRoman },
|
||||
{ "da", langDanish, smRoman },
|
||||
{ "nl", langDutch, smRoman },
|
||||
{ "en", langEnglish, smRoman },
|
||||
{ "eo", langEsperanto, smRoman },
|
||||
{ "et", langEstonian, smCentralEuroRoman},
|
||||
{ "fo", langFaeroese, smRoman },
|
||||
{ "fa", langFarsi, smArabic },
|
||||
{ "fi", langFinnish, smRoman },
|
||||
{ "fr", langFrench, smRoman },
|
||||
{ "ka", langGeorgian, smGeorgian },
|
||||
{ "de", langGerman, smRoman },
|
||||
{ "el", langGreek, smGreek },
|
||||
{ "gn", langGuarani, smRoman },
|
||||
{ "gu", langGujarati, smGujarati },
|
||||
{ "he", langHebrew, smHebrew },
|
||||
{ "iw", langHebrew, smHebrew },
|
||||
{ "hu", langHungarian, smCentralEuroRoman },
|
||||
{ "is", langIcelandic, smRoman },
|
||||
{ "in", langIndonesian, smRoman },
|
||||
{ "id", langIndonesian, smRoman },
|
||||
{ "iu", langInuktitut, smEthiopic },
|
||||
{ "ga", langIrish, smRoman },
|
||||
{ "hi", langHindi, smDevanagari },
|
||||
{ "it", langItalian, smRoman },
|
||||
{ "ja", langJapanese, smJapanese },
|
||||
{ "jw", langJavaneseRom, smRoman },
|
||||
{ "kn", langKannada, smKannada },
|
||||
{ "ks", langKashmiri, smArabic },
|
||||
{ "kk", langKazakh, smCyrillic },
|
||||
{ "ky", langKirghiz, smCyrillic },
|
||||
{ "ko", langKorean, smKorean },
|
||||
{ "ku", langKurdish, smArabic },
|
||||
{ "lo", langLao, smLao },
|
||||
{ "la", langLatin, smRoman },
|
||||
{ "lv", langLatvian, smCentralEuroRoman },
|
||||
{ "lt", langLithuanian, smCentralEuroRoman },
|
||||
{ "mk", langMacedonian, smCyrillic },
|
||||
{ "mg", langMalagasy, smRoman },
|
||||
{ "ml", langMalayalam, smMalayalam },
|
||||
{ "mt", langMaltese, smRoman },
|
||||
{ "mr", langMarathi, smDevanagari },
|
||||
{ "mo", langMoldavian, smCyrillic },
|
||||
{ "ne", langNepali, smDevanagari },
|
||||
{ "nb", langNorwegian, smRoman }, // Norwegian Bokmål
|
||||
{ "no", langNorwegian, smRoman },
|
||||
{ "nn", langNynorsk, smRoman },
|
||||
{ "or", langOriya, smOriya },
|
||||
{ "om", langOromo, smEthiopic },
|
||||
{ "ps", langPashto, smArabic },
|
||||
{ "pl", langPolish, smCentralEuroRoman },
|
||||
{ "pt", langPortuguese, smRoman },
|
||||
{ "pa", langPunjabi, smGurmukhi },
|
||||
{ "ro", langRomanian, smRoman },
|
||||
{ "ru", langRussian, smCyrillic },
|
||||
{ "sa", langSanskrit, smDevanagari },
|
||||
{ "sr", langSerbian, smCyrillic },
|
||||
{ "sd", langSindhi, smArabic },
|
||||
{ "si", langSinhalese, smSinhalese },
|
||||
{ "sk", langSlovak, smCentralEuroRoman },
|
||||
{ "sl", langSlovenian, smRoman },
|
||||
{ "so", langSomali, smRoman },
|
||||
{ "es", langSpanish, smRoman },
|
||||
{ "su", langSundaneseRom, smRoman },
|
||||
{ "sw", langSwahili, smRoman },
|
||||
{ "sv", langSwedish, smRoman },
|
||||
{ "tl", langTagalog, smRoman },
|
||||
{ "tg", langTajiki, smCyrillic },
|
||||
{ "ta", langTamil, smTamil },
|
||||
{ "tt", langTatar, smCyrillic },
|
||||
{ "te", langTelugu, smTelugu },
|
||||
{ "th", langThai, smThai },
|
||||
{ "bo", langTibetan, smTibetan },
|
||||
{ "ti", langTigrinya, smEthiopic },
|
||||
{ "tr", langTurkish, smRoman },
|
||||
{ "tk", langTurkmen, smCyrillic },
|
||||
{ "ug", langUighur, smCyrillic },
|
||||
{ "uk", langUkrainian, smCyrillic },
|
||||
{ "ur", langUrdu, smArabic },
|
||||
{ "uz", langUzbek, smCyrillic },
|
||||
{ "vi", langVietnamese, smVietnamese },
|
||||
{ "cy", langWelsh, smRoman },
|
||||
{ "ji", langYiddish, smHebrew },
|
||||
{ "yi", langYiddish, smHebrew },
|
||||
{ nsnull, 0, 0}
|
||||
};
|
||||
|
||||
struct iso_country_map
|
||||
{
|
||||
const char* iso_code;
|
||||
short mac_region_code;
|
||||
};
|
||||
|
||||
typedef struct iso_country_map iso_country_map;
|
||||
|
||||
const iso_country_map country_list[] = {
|
||||
{ "US", verUS},
|
||||
{ "EG", verArabic},
|
||||
{ "DZ", verArabic},
|
||||
{ "AU", verAustralia},
|
||||
{ "BE", verFrBelgium },
|
||||
{ "CA", verEngCanada },
|
||||
{ "CN", verChina },
|
||||
{ "HR", verYugoCroatian },
|
||||
{ "CY", verCyprus },
|
||||
{ "DK", verDenmark },
|
||||
{ "EE", verEstonia },
|
||||
{ "FI", verFinland },
|
||||
{ "FR", verFrance },
|
||||
{ "DE", verGermany },
|
||||
{ "EL", verGreece },
|
||||
{ "HU", verHungary },
|
||||
{ "IS", verIceland },
|
||||
{ "IN", verIndiaHindi},
|
||||
{ "IR", verIran },
|
||||
{ "IQ", verArabic },
|
||||
{ "IE", verIreland },
|
||||
{ "IL", verIsrael },
|
||||
{ "IT", verItaly },
|
||||
{ "JP", verJapan },
|
||||
{ "KR", verKorea },
|
||||
{ "LV", verLatvia },
|
||||
{ "LY", verArabic },
|
||||
{ "LT", verLithuania },
|
||||
{ "LU", verFrBelgiumLux },
|
||||
{ "MT", verMalta },
|
||||
{ "MA", verArabic },
|
||||
{ "NL", verNetherlands },
|
||||
{ "NO", verNorway },
|
||||
{ "PK", verPakistan },
|
||||
{ "PL", verPoland },
|
||||
{ "PT", verPortugal },
|
||||
{ "RU", verRussia },
|
||||
{ "SA", verArabic },
|
||||
{ "ES", verSpain },
|
||||
{ "SE", verSweden },
|
||||
{ "CH", verFrSwiss },
|
||||
{ "TW", verTaiwan},
|
||||
{ "TH", verThailand },
|
||||
{ "TN", verArabic},
|
||||
{ "TR", verTurkey },
|
||||
{ "GB", verBritain },
|
||||
{ nsnull, 0 }
|
||||
};
|
||||
|
||||
|
||||
/* nsMacLocale ISupports */
|
||||
NS_IMPL_ISUPPORTS1(nsMacLocale,nsIMacLocale)
|
||||
|
||||
nsMacLocale::nsMacLocale(void)
|
||||
{
|
||||
}
|
||||
|
||||
nsMacLocale::~nsMacLocale(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacLocale::GetPlatformLocale(const nsAString& locale, short* scriptCode, short* langCode, short* regionCode)
|
||||
{
|
||||
char locale_string[9] = {'\0','\0','\0','\0','\0','\0','\0','\0','\0'};
|
||||
char* language_code;
|
||||
char* country_code;
|
||||
bool validCountryFound;
|
||||
int i, j;
|
||||
|
||||
// parse the locale
|
||||
const PRUnichar* data;
|
||||
j = NS_StringGetData(locale, &data);
|
||||
for (i = 0; i < 7 && i < j; i++) {
|
||||
locale_string[i] = data[i] == '-' ? '\0' : data[i];
|
||||
}
|
||||
|
||||
language_code = locale_string;
|
||||
country_code = locale_string + strlen(locale_string) + 1;
|
||||
|
||||
// convert parsed locale to Mac OS locale
|
||||
if (country_code[0]!=0)
|
||||
{
|
||||
validCountryFound=false;
|
||||
for(i=0;country_list[i].iso_code;i++) {
|
||||
if (strcmp(country_list[i].iso_code,country_code)==0) {
|
||||
*regionCode = country_list[i].mac_region_code;
|
||||
validCountryFound=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!validCountryFound) {
|
||||
*scriptCode = smRoman;
|
||||
*langCode = langEnglish;
|
||||
*regionCode = verUS;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;lang_list[i].iso_code;i++) {
|
||||
if (strcmp(lang_list[i].iso_code, language_code)==0) {
|
||||
*scriptCode = lang_list[i].mac_script_code;
|
||||
*langCode = lang_list[i].mac_lang_code;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
*scriptCode = smRoman;
|
||||
*langCode = langEnglish;
|
||||
*regionCode = verUS;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacLocale::GetXPLocale(short scriptCode, short langCode, short regionCode, nsAString& locale)
|
||||
{
|
||||
|
||||
int i;
|
||||
bool validResultFound = false;
|
||||
|
||||
locale.Truncate();
|
||||
|
||||
//
|
||||
// parse language
|
||||
//
|
||||
for(i=0;lang_list[i].iso_code;i++) {
|
||||
if (langCode==lang_list[i].mac_lang_code && scriptCode==lang_list[i].mac_script_code) {
|
||||
CopyASCIItoUTF16(nsDependentCString(lang_list[i].iso_code), locale);
|
||||
validResultFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!validResultFound) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//
|
||||
// parse region
|
||||
//
|
||||
for(i=0;country_list[i].iso_code;i++) {
|
||||
if (regionCode==country_list[i].mac_region_code) {
|
||||
locale.Append(PRUnichar('-'));
|
||||
AppendASCIItoUTF16(country_list[i].iso_code, locale);
|
||||
validResultFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (validResultFound) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
|
@ -72,7 +72,6 @@
|
|||
#ifdef USE_MAC_LOCALE
|
||||
#include "nsCollationMacUC.h"
|
||||
#include "nsDateTimeFormatMac.h"
|
||||
#include "nsMacLocale.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_UNIX_LOCALE
|
||||
|
@ -117,7 +116,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatUnix)
|
|||
#endif
|
||||
|
||||
#ifdef USE_MAC_LOCALE
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacLocale)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationMacUC)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatMac)
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
# include "nsIOS2Locale.h"
|
||||
#elif defined(XP_MACOSX)
|
||||
# include <Carbon/Carbon.h>
|
||||
# include "nsIMacLocale.h"
|
||||
#elif defined(XP_UNIX)
|
||||
# include <locale.h>
|
||||
# include <stdlib.h>
|
||||
|
|
|
@ -174,13 +174,11 @@ typedef enum nsCharType nsCharType;
|
|||
#define IBMBIDI_TEXTTYPE_STR "bidi.texttype"
|
||||
#define IBMBIDI_NUMERAL_STR "bidi.numeral"
|
||||
#define IBMBIDI_SUPPORTMODE_STR "bidi.support"
|
||||
#define IBMBIDI_CHARSET_STR "bidi.characterset"
|
||||
|
||||
#define IBMBIDI_TEXTDIRECTION 1
|
||||
#define IBMBIDI_TEXTTYPE 2
|
||||
#define IBMBIDI_NUMERAL 4
|
||||
#define IBMBIDI_SUPPORTMODE 5
|
||||
#define IBMBIDI_CHARSET 6
|
||||
|
||||
// ------------------
|
||||
// Text Direction
|
||||
|
@ -213,32 +211,22 @@ typedef enum nsCharType nsCharType;
|
|||
#define IBMBIDI_SUPPORTMODE_MOZILLA 1 // 1 = mozillaBidisupport *
|
||||
#define IBMBIDI_SUPPORTMODE_OSBIDI 2 // 2 = OsBidisupport
|
||||
#define IBMBIDI_SUPPORTMODE_DISABLE 3 // 3 = disableBidisupport
|
||||
// ------------------
|
||||
// Charset Mode
|
||||
// ------------------
|
||||
// bidi.characterset
|
||||
#define IBMBIDI_CHARSET_BIDI 1 // 1 = doccharactersetBidi *
|
||||
#define IBMBIDI_CHARSET_DEFAULT 2 // 2 = defaultcharactersetBidi
|
||||
|
||||
#define IBMBIDI_DEFAULT_BIDI_OPTIONS \
|
||||
((IBMBIDI_TEXTDIRECTION_LTR<<0) | \
|
||||
(IBMBIDI_TEXTTYPE_CHARSET<<4) | \
|
||||
(IBMBIDI_NUMERAL_NOMINAL<<8) | \
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<12) | \
|
||||
(IBMBIDI_CHARSET_BIDI<<16))
|
||||
|
||||
(IBMBIDI_SUPPORTMODE_MOZILLA<<12))
|
||||
|
||||
#define GET_BIDI_OPTION_DIRECTION(bo) (((bo)>>0) & 0x0000000F) /* 4 bits for DIRECTION */
|
||||
#define GET_BIDI_OPTION_TEXTTYPE(bo) (((bo)>>4) & 0x0000000F) /* 4 bits for TEXTTYPE */
|
||||
#define GET_BIDI_OPTION_NUMERAL(bo) (((bo)>>8) & 0x0000000F) /* 4 bits for NUMERAL */
|
||||
#define GET_BIDI_OPTION_SUPPORT(bo) (((bo)>>12) & 0x0000000F) /* 4 bits for SUPPORT */
|
||||
#define GET_BIDI_OPTION_CHARACTERSET(bo) (((bo)>>16) & 0x0000000F) /* 4 bits for CHARACTERSET */
|
||||
|
||||
#define SET_BIDI_OPTION_DIRECTION(bo, dir) {(bo)=((bo) & 0xFFFFFFF0)|(((dir)& 0x0000000F)<<0);}
|
||||
#define SET_BIDI_OPTION_TEXTTYPE(bo, tt) {(bo)=((bo) & 0xFFFFFF0F)|(((tt)& 0x0000000F)<<4);}
|
||||
#define SET_BIDI_OPTION_NUMERAL(bo, num) {(bo)=((bo) & 0xFFFFF0FF)|(((num)& 0x0000000F)<<8);}
|
||||
#define SET_BIDI_OPTION_SUPPORT(bo, sup) {(bo)=((bo) & 0xFFFF0FFF)|(((sup)& 0x0000000F)<<12);}
|
||||
#define SET_BIDI_OPTION_CHARACTERSET(bo, cs) {(bo)=((bo) & 0xFFF0FFFF)|(((cs)& 0x0000000F)<<16);}
|
||||
|
||||
/* Constants related to the position of numerics in the codepage */
|
||||
#define START_HINDI_DIGITS 0x0660
|
||||
|
|
|
@ -83,16 +83,8 @@ include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
|||
ifdef _MSC_VER
|
||||
# Always enter a Windows program through wmain, whether or not we're
|
||||
# a console application.
|
||||
ifdef WINCE
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
|
||||
else
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef WINCE
|
||||
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,corelibc)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
|
||||
|
|
|
@ -478,10 +478,6 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params)
|
|||
PRTimeParameters
|
||||
PR_GMTParameters(const PRExplodedTime *gmt)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (gmt)
|
||||
#endif
|
||||
|
||||
PRTimeParameters retVal = { 0, 0 };
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -153,22 +153,6 @@
|
|||
#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
|
||||
#endif /* _WINDLL */
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
|
||||
#define PR_EXPORT(__type) extern __declspec(export) __type
|
||||
#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
|
||||
#define PR_IMPORT(__type) extern __declspec(export) __type
|
||||
#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
|
||||
|
||||
#define PR_EXTERN(__type) extern __declspec(export) __type
|
||||
#define PR_IMPLEMENT(__type) __declspec(export) __type
|
||||
#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
|
||||
#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
|
||||
|
||||
#define PR_CALLBACK
|
||||
#define PR_CALLBACK_DECL
|
||||
#define PR_STATIC_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(XP_OS2) && defined(__declspec)
|
||||
|
||||
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
||||
|
@ -500,7 +484,7 @@ typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
|
|||
|
||||
#ifndef __PRUNICHAR__
|
||||
#define __PRUNICHAR__
|
||||
#if defined(WIN32) || defined(XP_MAC)
|
||||
#if defined(WIN32)
|
||||
typedef wchar_t PRUnichar;
|
||||
#else
|
||||
typedef PRUint16 PRUnichar;
|
||||
|
|
|
@ -63,12 +63,8 @@ LIBS = \
|
|||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifdef _MSC_VER
|
||||
ifdef WINCE
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
|
||||
else
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -147,7 +147,6 @@ CPPSRCS = \
|
|||
jsgcmark.cpp \
|
||||
jsgcchunk.cpp \
|
||||
jsgcstats.cpp \
|
||||
GlobalObject.cpp \
|
||||
jshash.cpp \
|
||||
jsinterp.cpp \
|
||||
jsinvoke.cpp \
|
||||
|
@ -181,6 +180,7 @@ CPPSRCS = \
|
|||
jsxml.cpp \
|
||||
prmjtime.cpp \
|
||||
sharkctl.cpp \
|
||||
GlobalObject.cpp \
|
||||
Stack.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
@ -214,7 +214,6 @@ INSTALLED_HEADERS = \
|
|||
jsgcchunk.h \
|
||||
jsgcstats.h \
|
||||
jscompartment.h \
|
||||
GlobalObject.h \
|
||||
jshash.h \
|
||||
jsinterp.h \
|
||||
jsinttypes.h \
|
||||
|
@ -278,6 +277,7 @@ VPATH += \
|
|||
EXPORTS_NAMESPACES = vm
|
||||
|
||||
EXPORTS_vm = \
|
||||
GlobalObject.h \
|
||||
Stack.h \
|
||||
StringObject.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -6,19 +6,18 @@ set terminal png
|
|||
set title "Title goes here!"
|
||||
set datafile missing "-"
|
||||
set noxtics
|
||||
set ytics nomirror
|
||||
#set ytics nomirror
|
||||
set ylabel "msec"
|
||||
set y2tics nomirror
|
||||
set y2label "Chunk count"
|
||||
set key below
|
||||
set style data linespoints
|
||||
|
||||
#set data file
|
||||
plot 'gcTimer.dat' using 2 title columnheader(2), \
|
||||
'' u 3 title columnheader(3), \
|
||||
'' u 3 title columnheader(3) with points, \
|
||||
'' u 4 title columnheader(4), \
|
||||
'' u 5 title columnheader(5) with points, \
|
||||
'' u 5 title columnheader(5), \
|
||||
'' u 6 title columnheader(6) with points, \
|
||||
'' u 7 title columnheader(7) with points, \
|
||||
'' u 8 title columnheader(8) with points axis x1y2, \
|
||||
'' u 9 title columnheader(9) with points axis x1y2
|
||||
'' u 8 title columnheader(8) with points, \
|
||||
'' u 9 title columnheader(9) with points, \
|
||||
'' u 10 title columnheader(10) with points
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
// ES5 15.1.2.2 step 1
|
||||
|
||||
/*
|
||||
* Boundary testing for super-large positive numbers between non-exponential
|
||||
* and in-exponential-form.
|
||||
*
|
||||
* NB: While 1e21 is exactly representable as an IEEE754 double-precision
|
||||
* number, its nearest neighboring representable values are a good distance
|
||||
* away, 65536 to be precise.
|
||||
*/
|
||||
|
||||
// This is the boundary in theory.
|
||||
assertEq(parseInt(1e21), 1);
|
||||
|
||||
// This is the boundary in practice.
|
||||
assertEq(parseInt(1e21 - 65537) > 1e20, true);
|
||||
assertEq(parseInt(1e21 - 65536), 1);
|
||||
assertEq(parseInt(1e21 + 65536), 1);
|
||||
|
||||
// Check that we understand floating point accuracy near the boundary
|
||||
assertEq(1e21 - 65537 !== 1e21 - 65536, true);
|
||||
assertEq(1e21 - 65536, 1e21);
|
||||
assertEq(1e21 + 65535, 1e21);
|
||||
assertEq(1e21 + 65536, 1e21);
|
||||
|
||||
// ES5 leaves exact precision in ToString(bigMagNum) undefined, which
|
||||
// might make this value inconsistent across implementations (maybe,
|
||||
// nobody's done the math here). Regardless, it's definitely a number
|
||||
// very close to 1, and not a large-magnitude positive number.
|
||||
assertEq(1e21 + 65537 !== 1e21, true);
|
||||
assertEq(parseInt(1e21 + 65537) < 1.001, true);
|
||||
|
||||
|
||||
/*
|
||||
* Now do the same tests for super-large negative numbers crossing the
|
||||
* opposite boundary.
|
||||
*/
|
||||
|
||||
// This is the boundary in theory.
|
||||
assertEq(parseInt(-1e21), -1);
|
||||
|
||||
// This is the boundary in practice.
|
||||
assertEq(parseInt(-1e21 + 65537) < -1e20, true);
|
||||
assertEq(parseInt(-1e21 + 65536), -1);
|
||||
assertEq(parseInt(-1e21 - 65536), -1);
|
||||
|
||||
// Check that we understand floating point accuracy near the boundary
|
||||
assertEq(-1e21 + 65537 !== -1e21 + 65536, true);
|
||||
assertEq(-1e21 + 65536, -1e21);
|
||||
assertEq(-1e21 - 65535, -1e21);
|
||||
assertEq(-1e21 - 65536, -1e21);
|
||||
|
||||
// ES5 leaves exact precision in ToString(bigMagNum) undefined, which
|
||||
// might make this value inconsistent across implementations (maybe,
|
||||
// nobody's done the math here). Regardless, it's definitely a number
|
||||
// very close to -1, and not a large-magnitude negative number.
|
||||
assertEq(-1e21 - 65537 !== 1e21, true);
|
||||
assertEq(parseInt(-1e21 - 65537) > -1.001, true);
|
||||
|
||||
|
||||
/* Check values around the boundary. */
|
||||
arr = [1e0, 5e1, 9e19, 0.1e20, 1.3e20, 1e20, 9e20, 9.99e20, 0.1e21,
|
||||
1e21, 1.0e21, 2e21, 2e20, 2.1e22, 9e21, 0.1e22, 1e22, 3e46, 3e23, 3e100, 3.4e200, 7e1000,
|
||||
1e21, 1e21+65537, 1e21+65536, 1e21-65536, 1e21-65537];
|
||||
|
||||
/* Check across a range of values in case we missed anything. */
|
||||
for (var i = 0; i < 4000; i++) {
|
||||
arr.push(1e19 + i*1e19);
|
||||
}
|
||||
|
||||
for (var i in arr) {
|
||||
assertEq(parseInt( arr[i]), parseInt(String( arr[i])));
|
||||
assertEq(parseInt(-arr[i]), parseInt(String(-arr[i])));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
this.__proto__ = null;
|
||||
Object.prototype.__proto__ = this;
|
||||
for (var x in Object.prototype);
|
|
@ -0,0 +1,5 @@
|
|||
function g(a, b, c, d) {}
|
||||
function f(a, b, c) {
|
||||
arguments.length=8.64e15;
|
||||
g.apply(this, arguments);
|
||||
}f();
|
|
@ -670,6 +670,10 @@ JSRuntime::init(uint32 maxbytes)
|
|||
propTreeDumpFilename = getenv("JS_PROPTREE_DUMPFILE");
|
||||
#endif
|
||||
|
||||
#ifdef JS_TRACER
|
||||
InitJIT();
|
||||
#endif
|
||||
|
||||
if (!js_InitGC(this, maxbytes))
|
||||
return false;
|
||||
|
||||
|
@ -726,6 +730,10 @@ JSRuntime::~JSRuntime()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef JS_TRACER
|
||||
FinishJIT();
|
||||
#endif
|
||||
|
||||
js_FinishThreads(this);
|
||||
js_FreeRuntimeScriptState(this);
|
||||
js_FinishAtomState(this);
|
||||
|
@ -4034,11 +4042,11 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
|||
shape = shape->previous();
|
||||
|
||||
if (!shape->previous()) {
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->id));
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->propid));
|
||||
*idp = JSID_VOID;
|
||||
} else {
|
||||
iterobj->setPrivate(const_cast<Shape *>(shape->previous()));
|
||||
*idp = shape->id;
|
||||
*idp = shape->propid;
|
||||
}
|
||||
} else {
|
||||
/* Non-native case: use the ida enumerated when iterobj was created. */
|
||||
|
@ -4264,7 +4272,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
|||
obj = obj->getParent();
|
||||
}
|
||||
|
||||
if (!obj->getProperty(cx, r.front().id, clone->getFlatClosureUpvars() + i))
|
||||
if (!obj->getProperty(cx, r.front().propid, clone->getFlatClosureUpvars() + i))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -235,21 +235,6 @@ js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
|
|||
return ValueToECMAUint32(cx, tvr.value(), (uint32_t *)lengthp);
|
||||
}
|
||||
|
||||
JSBool JS_FASTCALL
|
||||
js_IndexToId(JSContext *cx, jsuint index, jsid *idp)
|
||||
{
|
||||
JSString *str;
|
||||
|
||||
if (index <= JSID_INT_MAX) {
|
||||
*idp = INT_TO_JSID(index);
|
||||
return JS_TRUE;
|
||||
}
|
||||
str = js_NumberToString(cx, index);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
return js_ValueToStringId(cx, StringValue(str), idp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
BigIndexToId(JSContext *cx, JSObject *obj, jsuint index, JSBool createAtom,
|
||||
jsid *idp)
|
||||
|
@ -2138,7 +2123,7 @@ ArrayCompPushImpl(JSContext *cx, JSObject *obj, const Value &v)
|
|||
if (obj->isSlowArray()) {
|
||||
/* This can happen in one evil case. See bug 630377. */
|
||||
jsid id;
|
||||
return js_IndexToId(cx, length, &id) &&
|
||||
return IndexToId(cx, length, &id) &&
|
||||
js_DefineProperty(cx, obj, id, &v, NULL, NULL, JSPROP_ENUMERATE);
|
||||
}
|
||||
|
||||
|
|
|
@ -197,9 +197,6 @@ js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length);
|
|||
extern JSBool
|
||||
js_HasLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
|
||||
|
||||
extern JSBool JS_FASTCALL
|
||||
js_IndexToId(JSContext *cx, jsuint index, jsid *idp);
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
|
|
|
@ -130,4 +130,27 @@ js_Int32ToId(JSContext* cx, int32 index, jsid* id)
|
|||
return js_ValueToStringId(cx, js::StringValue(str), id);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
inline bool
|
||||
IndexToId(JSContext *cx, uint32 index, jsid *idp)
|
||||
{
|
||||
if (index <= JSID_INT_MAX) {
|
||||
*idp = INT_TO_JSID(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
JSString *str = js_NumberToString(cx, index);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
JSAtom *atom = js_AtomizeString(cx, str, 0);
|
||||
if (!atom)
|
||||
return false;
|
||||
*idp = ATOM_TO_JSID(atom);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif /* jsatominlines_h___ */
|
||||
|
|
|
@ -125,7 +125,6 @@ static JSFunctionSpec boolean_methods[] = {
|
|||
#endif
|
||||
JS_FN(js_toString_str, bool_toString, 0, 0),
|
||||
JS_FN(js_valueOf_str, bool_valueOf, 0, 0),
|
||||
JS_FN(js_toJSON_str, bool_valueOf, 0, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче