Merge the last green changeset on mozilla-inbound to mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-07-27 14:02:24 -04:00
Родитель 884ace2b1e b6f9f332e2
Коммит 60276a4e8e
73 изменённых файлов: 67995 добавлений и 3731 удалений

Просмотреть файл

@ -330,6 +330,7 @@ XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
XSS_LIBS = @XSS_LIBS@
MOZ_THUMB2 = @MOZ_THUMB2@
MOZ_EGL_XRENDER_COMPOSITE = @MOZ_EGL_XRENDER_COMPOSITE@
WIN_TOP_SRC = @WIN_TOP_SRC@
AR = @AR@

Просмотреть файл

@ -7178,6 +7178,20 @@ fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl = XRender Composite
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
[ --enable-egl-xrender-composite
Enable EGL xrender composite optimizations],
MOZ_EGL_XRENDER_COMPOSITE=1)
if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
fi
AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
dnl ========================================================
dnl = faststripe theme
dnl ========================================================

Просмотреть файл

@ -229,7 +229,7 @@ private:
void FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart,
const PRUnichar *aTextLimit,
PRPackedBool *aBreakState);
PRUint8 *aBreakState);
nsAutoTArray<PRUnichar,100> mCurrentWord;
// All the items that contribute to mCurrentWord

Просмотреть файл

@ -4005,7 +4005,7 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
PRBool appending =
!IsNodeOfType(eDOCUMENT) && PRUint32(insPos) == GetChildCount();
PRBool firstInsPos = insPos;
PRInt32 firstInsPos = insPos;
nsIContent* firstInsertedContent = fragChildren[0];
// Iterate through the fragment's children, and insert them in the new

Просмотреть файл

@ -312,7 +312,7 @@ void
nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart,
const PRUnichar *aTextLimit,
PRPackedBool *aBreakState)
PRUint8 *aBreakState)
{
nsDependentSubstring string(aTextStart, aTextLimit);
nsAutoTArray<PRPackedBool,200> hyphens;
@ -414,7 +414,7 @@ nsLineBreaker::AppendText(nsIAtom* aLangGroup, const PRUint8* aText, PRUint32 aL
if (aSink && !(aFlags & BREAK_SUPPRESS_INSIDE)) {
// Save current start-of-word state because GetJISx4051Breaks will
// set it to false
PRPackedBool currentStart = breakState[wordStart];
PRUint8 currentStart = breakState[wordStart];
nsContentUtils::LineBreaker()->
GetJISx4051Breaks(aText + wordStart, offset - wordStart,
breakState.Elements() + wordStart);

Просмотреть файл

@ -247,7 +247,7 @@ nsIURIFixup *nsDocShell::sURIFixup = 0;
// True means we validate window targets to prevent frameset
// spoofing. Initialize this to a non-bolean value so we know to check
// the pref on the creation of the first docshell.
static PRBool gValidateOrigin = (PRBool)0xffffffff;
static PRUint32 gValidateOrigin = 0xffffffff;
// Hint for native dispatch of events on how long to delay after
// all documents have loaded in milliseconds before favoring normal
@ -4504,7 +4504,7 @@ nsDocShell::Create()
mAllowSubframes =
Preferences::GetBool("browser.frames.enabled", mAllowSubframes);
if (gValidateOrigin == (PRBool)0xffffffff) {
if (gValidateOrigin == 0xffffffff) {
// Check pref to see if we should prevent frameset spoofing
gValidateOrigin =
Preferences::GetBool("browser.frame.validate_origin", PR_TRUE);

Просмотреть файл

@ -60,6 +60,7 @@ using mozilla::gfx::SharedDIBSurface;
#include "gfxAlphaRecovery.h"
#include "mozilla/ipc/SyncChannel.h"
#include "mozilla/AutoRestore.h"
using mozilla::ipc::ProcessChild;
using namespace mozilla::plugins;
@ -1547,14 +1548,8 @@ PluginInstanceChild::TrackPopupHookProc(HMENU hMenu,
// can act on the menu item selected.
bool isRetCmdCall = (uFlags & TPM_RETURNCMD);
// A little trick scrounged from chromium's code - set the focus
// to our surrogate parent so keyboard nav events go to the menu.
HWND focusHwnd = SetFocus(surrogateHwnd);
DWORD res = sUser32TrackPopupMenuStub(hMenu, uFlags|TPM_RETURNCMD, x, y,
nReserved, surrogateHwnd, prcRect);
if (IsWindow(focusHwnd)) {
SetFocus(focusHwnd);
}
if (!isRetCmdCall && res) {
SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(res, 0), 0);
@ -1620,6 +1615,8 @@ PluginInstanceChild::WinlessHandleEvent(NPEvent& event)
// Events that might generate nested event dispatch loops need
// special handling during delivery.
int16_t handled;
HWND focusHwnd = NULL;
// TrackPopupMenu will fail if the parent window is not associated with
// our ui thread. So we hook TrackPopupMenu so we can hand in a surrogate
@ -1628,12 +1625,23 @@ PluginInstanceChild::WinlessHandleEvent(NPEvent& event)
(event.event == WM_RBUTTONDOWN || // flash
event.event == WM_RBUTTONUP)) { // silverlight
sWinlessPopupSurrogateHWND = mWinlessPopupSurrogateHWND;
// A little trick scrounged from chromium's code - set the focus
// to our surrogate parent so keyboard nav events go to the menu.
focusHwnd = SetFocus(mWinlessPopupSurrogateHWND);
}
MessageLoop* loop = MessageLoop::current();
AutoRestore<bool> modalLoop(loop->os_modal_loop());
handled = mPluginIface->event(&mData, reinterpret_cast<void*>(&event));
sWinlessPopupSurrogateHWND = NULL;
if (IsWindow(focusHwnd)) {
SetFocus(focusHwnd);
}
return handled;
}

Просмотреть файл

@ -2289,12 +2289,13 @@ PluginModuleChild::NestedInputEventHook(int nCode, WPARAM wParam, LPARAM lParam)
PluginModuleChild* self = current();
PRUint32 len = self->mIncallPumpingStack.Length();
if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]._spinning) {
MessageLoop* loop = MessageLoop::current();
self->SendProcessNativeEventsInRPCCall();
IncallFrame& f = self->mIncallPumpingStack[len - 1];
f._spinning = true;
MessageLoop* loop = MessageLoop::current();
f._savedNestableTasksAllowed = loop->NestableTasksAllowed();
loop->SetNestableTasksAllowed(true);
loop->set_os_modal_loop(true);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);

Просмотреть файл

@ -5084,7 +5084,7 @@ nsHTMLEditRules::GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode> &outA
// ExpandSelectionForDeletion: this promotes our selection to include blocks
// that have all their children selected.
//
PRBool
nsresult
nsHTMLEditRules::ExpandSelectionForDeletion(nsISelection *aSelection)
{
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);

Просмотреть файл

@ -226,7 +226,7 @@ protected:
PRBool *aHandled);
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
nsCOMPtr<nsIDOMNode> *outBRNode, PRInt32 aOffset=0);
PRBool ExpandSelectionForDeletion(nsISelection *aSelection);
nsresult ExpandSelectionForDeletion(nsISelection *aSelection);
PRBool IsFirstNode(nsIDOMNode *aNode);
PRBool IsLastNode(nsIDOMNode *aNode);
#ifdef XXX_DEAD_CODE

Просмотреть файл

@ -2677,7 +2677,7 @@ nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **table
}
//Return actual number of cells (a cell with colspan > 1 counts as just 1)
PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex)
PRInt32 nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex)
{
PRInt32 cellCount = 0;
nsCOMPtr<nsIDOMElement> cell;
@ -2689,7 +2689,7 @@ PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowInd
res = GetCellDataAt(aTable, rowIndex, colIndex, getter_AddRefs(cell),
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
&actualRowSpan, &actualColSpan, &isSelected);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_SUCCESS(res, 0);
if (cell)
{
// Only count cells that start in row we are working with

Просмотреть файл

@ -83,6 +83,7 @@ abstract public class GeckoApp
enum LaunchState {PreLaunch, Launching, WaitButton,
Launched, GeckoRunning, GeckoExiting};
private static LaunchState sLaunchState = LaunchState.PreLaunch;
private static boolean sTryCatchAttached = false;
static boolean checkLaunchState(LaunchState checkState) {
@ -188,18 +189,23 @@ abstract public class GeckoApp
mAppContext = this;
mMainHandler = new Handler();
mMainHandler.post(new Runnable() {
public void run() {
try {
Looper.loop();
} catch (Exception e) {
Log.e("GeckoApp", "top level exception", e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
GeckoAppShell.reportJavaCrash(sw.toString());
if (!sTryCatchAttached) {
sTryCatchAttached = true;
mMainHandler.post(new Runnable() {
public void run() {
try {
Looper.loop();
} catch (Exception e) {
Log.e("GeckoApp", "top level exception", e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
GeckoAppShell.reportJavaCrash(sw.toString());
}
// resetting this is kinda pointless, but oh well
sTryCatchAttached = false;
}
}
});
});
}
SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE);
String localeCode = settings.getString(getPackageName() + ".locale", "");

Просмотреть файл

@ -178,9 +178,10 @@ nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch,
// save cookie lifetime in seconds instead of days
mCookiesLifetimeSec = val * 24 * 60 * 60;
PRBool bval;
if (PREF_CHANGED(kCookiesAlwaysAcceptSession) &&
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &val)))
mCookiesAlwaysAcceptSession = val;
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &bval)))
mCookiesAlwaysAcceptSession = bval;
}
NS_IMETHODIMP

Просмотреть файл

@ -422,9 +422,11 @@ _cairo_xlib_device_create (Display *dpy)
if (VendorRelease (dpy) < 10400000)
display->buggy_repeat = TRUE;
#ifndef MOZ_EGL_XRENDER_COMPOSITE
/* Too many bugs in the early drivers */
if (VendorRelease (dpy) < 10699000)
display->buggy_pad_reflect = TRUE;
#endif
}
} else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
if (VendorRelease (dpy) <= 40500000)

Просмотреть файл

@ -1082,6 +1082,22 @@ BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface)
return;
}
// We need to read from the GLContext
mGLContext->MakeCurrent();
#if defined (MOZ_X11) && defined (MOZ_EGL_XRENDER_COMPOSITE)
mGLContext->fFinish();
gfxASurface* offscreenSurface = mGLContext->GetOffscreenPixmapSurface();
// XRender can only blend premuliplied alpha, so only allow xrender
// path if we have premultiplied alpha or opaque content.
if (offscreenSurface && (mGLBufferIsPremultiplied || (GetContentFlags() & CONTENT_OPAQUE))) {
mSurface = offscreenSurface;
mNeedsYFlip = false;
}
else
#endif
{
nsRefPtr<gfxImageSurface> isurf = aDestSurface ?
static_cast<gfxImageSurface*>(aDestSurface) :
new gfxImageSurface(gfxIntSize(mBounds.width, mBounds.height),
@ -1095,9 +1111,6 @@ BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface)
NS_ASSERTION(isurf->Stride() == mBounds.width * 4, "gfxImageSurface stride isn't what we expect!");
// We need to read from the GLContext
mGLContext->MakeCurrent();
// We have to flush to ensure that any buffered GL operations are
// in the framebuffer before we read.
mGLContext->fFlush();
@ -1132,6 +1145,7 @@ BasicCanvasLayer::UpdateSurface(gfxASurface* aDestSurface)
}
}
}
}
void
BasicCanvasLayer::Paint(gfxContext* aContext)
@ -1162,6 +1176,15 @@ BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext,
aContext->Scale(1.0, -1.0);
}
// If content opaque, then save off current operator and set to source.
// This ensures that alpha is not applied even if the source surface
// has an alpha channel
gfxContext::GraphicsOperator savedOp;
if (GetContentFlags() & CONTENT_OPAQUE) {
savedOp = aContext->CurrentOperator();
aContext->SetOperator(gfxContext::OPERATOR_SOURCE);
}
AutoSetOperator setOperator(aContext, GetOperator());
aContext->NewPath();
// No need to snap here; our transform is already set up to snap our rect
@ -1169,6 +1192,19 @@ BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext,
aContext->SetPattern(pat);
aContext->FillWithOpacity(aOpacity);
#if defined (MOZ_X11) && defined (MOZ_EGL_XRENDER_COMPOSITE)
if (mGLContext) {
// Wait for X to complete all operations before continuing
// Otherwise gl context could get cleared before X is done.
mGLContext->WaitNative();
}
#endif
// Restore surface operator
if (GetContentFlags() & CONTENT_OPAQUE) {
aContext->SetOperator(savedOp);
}
if (mNeedsYFlip) {
aContext->SetMatrix(m);
}

Просмотреть файл

@ -66,7 +66,7 @@
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#if defined(MOZ_PLATFORM_MAEMO) || defined(ANDROID)
#if defined(MOZ_PLATFORM_MAEMO) || defined(ANDROID) || defined(MOZ_EGL_XRENDER_COMPOSITE)
#define USE_GLES2 1
#endif
@ -737,6 +737,15 @@ public:
return mOffscreenTexture;
}
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
virtual gfxASurface* GetOffscreenPixmapSurface()
{
return 0;
};
virtual PRBool WaitNative() { return PR_FALSE; }
#endif
virtual PRBool TextureImageSupportsGetBackingSurface() {
return PR_FALSE;
}

Просмотреть файл

@ -84,6 +84,14 @@ namespace gl {
#endif
#endif
// X11, with XRender optimizations and no GL layer support
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE) && !defined(GL_CONTEXT_PROVIDER_DEFAULT)
#define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL
#include "GLContextProviderImpl.h"
#undef GL_CONTEXT_PROVIDER_NAME
#define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
#endif
// X11, but only if we didn't use EGL above
#if defined(MOZ_X11) && !defined(GL_CONTEXT_PROVIDER_DEFAULT)
#define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX

Просмотреть файл

@ -192,6 +192,12 @@ CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config);
EGLConfig
CreateConfig();
#ifdef MOZ_X11
#ifdef MOZ_EGL_XRENDER_COMPOSITE
static EGLSurface
CreateBasicEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig);
#endif
static EGLConfig
CreateEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig = nsnull, EGLenum aDepth = 0);
#endif
@ -391,7 +397,11 @@ public:
return PR_FALSE;
}
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
mEGLDisplay = fGetDisplay((EGLNativeDisplayType) gdk_x11_get_default_xdisplay());
#else
mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
#endif
if (!fInitialize(mEGLDisplay, NULL, NULL))
return PR_FALSE;
@ -720,6 +730,17 @@ public:
mIsDoubleBuffered = aIsDB;
}
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
gfxASurface* GetOffscreenPixmapSurface()
{
return mThebesSurface;
}
virtual PRBool WaitNative() {
return sEGLLibrary.fWaitNative(LOCAL_EGL_CORE_NATIVE_ENGINE);
}
#endif
PRBool BindTexImage()
{
if (!mSurface)
@ -857,6 +878,14 @@ public:
const ContextFormat& aFormat,
PRBool aShare);
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
static already_AddRefed<GLContextEGL>
CreateBasicEGLPixmapOffscreenContext(const gfxIntSize& aSize,
const ContextFormat& aFormat);
PRBool ResizeOffscreenPixmapSurface(const gfxIntSize& aNewSize);
#endif
static already_AddRefed<GLContextEGL>
CreateEGLPBufferOffscreenContext(const gfxIntSize& aSize,
const ContextFormat& aFormat);
@ -1060,6 +1089,10 @@ GLContextEGL::ResizeOffscreen(const gfxIntSize& aNewSize)
}
#endif
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
return ResizeOffscreenPixmapSurface(aNewSize);
#endif
return ResizeOffscreenFBO(aNewSize);
}
@ -2139,6 +2172,8 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& aSize,
#if defined(ANDROID) || defined(XP_WIN)
return GLContextEGL::CreateEGLPBufferOffscreenContext(aSize, aFormat);
#elif defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
return GLContextEGL::CreateBasicEGLPixmapOffscreenContext(aSize, aFormat);
#elif defined(MOZ_X11)
nsRefPtr<GLContextEGL> glContext =
GLContextEGL::CreateEGLPixmapOffscreenContext(aSize, aFormat, PR_TRUE);
@ -2241,6 +2276,181 @@ GLContextProviderEGL::Shutdown()
gGlobalContext = nsnull;
}
//------------------------------------------------------------------------------
// The following methods exist to support an accelerated WebGL XRender composite
// path for BasicLayers. This is a potentially temporary change that can be
// removed when performance of GL layers is superior on mobile linux platforms.
//------------------------------------------------------------------------------
#if defined(MOZ_X11) && defined(MOZ_EGL_XRENDER_COMPOSITE)
EGLSurface
CreateBasicEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig)
{
gfxXlibSurface* xsurface = static_cast<gfxXlibSurface*>(aSurface);
PRBool opaque =
aSurface->GetContentType() == gfxASurface::CONTENT_COLOR;
EGLSurface surface = nsnull;
if (aConfig && *aConfig) {
surface = sEGLLibrary.fCreatePixmapSurface(EGL_DISPLAY(), *aConfig,
xsurface->XDrawable(),
0);
if (surface != EGL_NO_SURFACE)
return surface;
}
EGLConfig configs[32];
int numConfigs = 32;
static EGLint pixmap_config[] = {
LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PIXMAP_BIT,
LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT,
0x30E2, 0x30E3,
LOCAL_EGL_DEPTH_SIZE, 16,
LOCAL_EGL_NONE
};
if (!sEGLLibrary.fChooseConfig(EGL_DISPLAY(),
pixmap_config,
configs, numConfigs, &numConfigs))
return nsnull;
if (numConfigs == 0)
return nsnull;
int i = 0;
for (i = 0; i < numConfigs; ++i) {
surface = sEGLLibrary.fCreatePixmapSurface(EGL_DISPLAY(), configs[i],
xsurface->XDrawable(),
0);
if (surface != EGL_NO_SURFACE)
break;
}
if (!surface) {
return nsnull;
}
if (aConfig)
{
*aConfig = configs[i];
}
return surface;
}
already_AddRefed<GLContextEGL>
GLContextEGL::CreateBasicEGLPixmapOffscreenContext(const gfxIntSize& aSize,
const ContextFormat& aFormat)
{
gfxASurface *thebesSurface = nsnull;
EGLNativePixmapType pixmap = 0;
XRenderPictFormat* format = gfxXlibSurface::FindRenderFormat(DefaultXDisplay(), gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxXlibSurface> xsurface =
gfxXlibSurface::Create(DefaultScreenOfDisplay(DefaultXDisplay()), format, aSize);
// XSync required after gfxXlibSurface::Create, otherwise EGL will fail with BadDrawable error
XSync(DefaultXDisplay(), False);
if (xsurface->CairoStatus() != 0)
{
return nsnull;
}
thebesSurface = xsurface;
pixmap = xsurface->XDrawable();
if (!pixmap) {
return nsnull;
}
EGLSurface surface = 0;
EGLConfig config = 0;
surface = CreateBasicEGLSurfaceForXSurface(xsurface, &config);
if (!config) {
return nsnull;
}
EGLint cxattribs[] = {
LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2,
LOCAL_EGL_NONE
};
EGLContext context = sEGLLibrary.fCreateContext(EGL_DISPLAY(),
config,
EGL_NO_CONTEXT,
cxattribs);
if (!context) {
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);
return nsnull;
}
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(aFormat, nsnull,
config, surface, context,
PR_TRUE);
if (!glContext->Init())
{
return nsnull;
}
glContext->HoldSurface(thebesSurface);
return glContext.forget();
}
PRBool GLContextEGL::ResizeOffscreenPixmapSurface(const gfxIntSize& aNewSize)
{
gfxASurface *thebesSurface = nsnull;
EGLNativePixmapType pixmap = 0;
XRenderPictFormat* format = gfxXlibSurface::FindRenderFormat(DefaultXDisplay(), gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxXlibSurface> xsurface =
gfxXlibSurface::Create(DefaultScreenOfDisplay(DefaultXDisplay()),
format,
aNewSize);
// XSync required after gfxXlibSurface::Create, otherwise EGL will fail with BadDrawable error
XSync(DefaultXDisplay(), False);
if (xsurface->CairoStatus() != 0)
return nsnull;
thebesSurface = xsurface;
pixmap = xsurface->XDrawable();
if (!pixmap) {
return nsnull;
}
EGLSurface surface = 0;
EGLConfig config = 0;
surface = CreateBasicEGLSurfaceForXSurface(xsurface, &config);
if (!surface) {
NS_WARNING("Failed to resize pbuffer");
return nsnull;
}
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
mSurface = surface;
HoldSurface(thebesSurface);
SetOffscreenSize(aNewSize, aNewSize);
MakeCurrent(PR_TRUE);
return PR_TRUE;
}
#endif
} /* namespace gl */
} /* namespace mozilla */

Просмотреть файл

@ -3197,5 +3197,6 @@ typedef ptrdiff_t GLintptr;
#define LOCAL_EGL_READ_SURFACE_BIT_KHR 0x0001
#define LOCAL_EGL_WRITE_SURFACE_BIT_KHR 0x0002
#define LOCAL_EGL_LOCK_SURFACE_BIT_KHR 0x0080
#define LOCAL_EGL_CORE_NATIVE_ENGINE 0x305B
#endif

Просмотреть файл

@ -338,9 +338,13 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
ifdef MOZ_PLATFORM_MAEMO
GL_PROVIDER = EGL
else
ifdef MOZ_EGL_XRENDER_COMPOSITE
GL_PROVIDER = EGL
else
GL_PROVIDER = GLX
endif
endif
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
ifdef MOZ_PLATFORM_MAEMO

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsServiceManagerUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "gfxGDIFontList.h"
@ -52,8 +53,6 @@
using namespace mozilla;
#ifdef PR_LOGGING
#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG, args)
#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \
@ -66,8 +65,6 @@ using namespace mozilla;
gfxPlatform::GetLog(eGfxLog_fontinit), \
PR_LOG_DEBUG)
#endif // PR_LOGGING
// font info loader constants
// avoid doing this during startup even on slow machines but try to start
@ -673,7 +670,6 @@ gfxDWriteFontList::InitFontList()
mInitialized = PR_FALSE;
#ifdef PR_LOGGING
LARGE_INTEGER frequency; // ticks per second
LARGE_INTEGER t1, t2, t3; // ticks
double elapsedTime, upTime;
@ -683,11 +679,10 @@ gfxDWriteFontList::InitFontList()
GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT,
NULL, NULL, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, NULL, NULL, NULL, nowDate, 256);
upTime = (double) GetTickCount();
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
}
#endif
upTime = (double) GetTickCount();
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
HRESULT hr;
gfxFontCache *fc = gfxFontCache::GetCache();
@ -702,11 +697,7 @@ gfxDWriteFontList::InitFontList()
mFontSubstitutes.Clear();
mNonExistingFonts.Clear();
#ifdef PR_LOGGING
if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t2);
}
#endif
QueryPerformanceCounter(&t2);
hr = gfxWindowsPlatform::GetPlatform()->GetDWriteFactory()->
GetGdiInterop(getter_AddRefs(mGDIInterop));
@ -716,10 +707,9 @@ gfxDWriteFontList::InitFontList()
LOGREGISTRY(L"InitFontList end");
#ifdef PR_LOGGING
if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t3);
QueryPerformanceCounter(&t3);
if (LOG_FONTINIT_ENABLED()) {
// determine dwrite version
nsAutoString dwriteVers;
gfxWindowsPlatform::GetDLLVersion(L"dwrite.dll", dwriteVers);
@ -728,14 +718,17 @@ gfxDWriteFontList::InitFontList()
LOG_FONTINIT(("Uptime: %9.3f s\n", upTime/1000));
LOG_FONTINIT(("dwrite version: %s\n",
NS_ConvertUTF16toUTF8(dwriteVers).get()));
elapsedTime = (t3.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT(("Total time in InitFontList: %9.3f ms\n", elapsedTime));
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT((" --- gfxPlatformFontList init: %9.3f ms\n", elapsedTime));
elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT((" --- GdiInterop object: %9.3f ms\n", elapsedTime));
}
#endif
elapsedTime = (t3.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_INITFONTLIST_TOTAL, elapsedTime);
LOG_FONTINIT(("Total time in InitFontList: %9.3f ms\n", elapsedTime));
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_INITFONTLIST_INIT, elapsedTime);
LOG_FONTINIT((" --- gfxPlatformFontList init: %9.3f ms\n", elapsedTime));
elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_INITFONTLIST_GDI, elapsedTime);
LOG_FONTINIT((" --- GdiInterop object: %9.3f ms\n", elapsedTime));
return NS_OK;
}
@ -745,7 +738,6 @@ gfxDWriteFontList::DelayedInitFontList()
{
LOGREGISTRY(L"DelayedInitFontList start");
#ifdef PR_LOGGING
LARGE_INTEGER frequency; // ticks per second
LARGE_INTEGER t1, t2, t3; // ticks
double elapsedTime, upTime;
@ -755,11 +747,11 @@ gfxDWriteFontList::DelayedInitFontList()
GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT,
NULL, NULL, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, NULL, NULL, NULL, nowDate, 256);
upTime = (double) GetTickCount();
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
}
#endif
upTime = (double) GetTickCount();
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
HRESULT hr;
@ -774,11 +766,7 @@ gfxDWriteFontList::DelayedInitFontList()
return NS_ERROR_FAILURE;
}
#ifdef PR_LOGGING
if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t2);
}
#endif
QueryPerformanceCounter(&t2);
for (UINT32 i = 0; i < systemFonts->GetFontFamilyCount(); i++) {
nsRefPtr<IDWriteFontFamily> family;
@ -965,10 +953,9 @@ gfxDWriteFontList::DelayedInitFontList()
LOGREGISTRY(L"DelayedInitFontList end");
#ifdef PR_LOGGING
if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t3);
QueryPerformanceCounter(&t3);
if (LOG_FONTINIT_ENABLED()) {
// determine dwrite version
nsAutoString dwriteVers;
gfxWindowsPlatform::GetDLLVersion(L"dwrite.dll", dwriteVers);
@ -977,17 +964,25 @@ gfxDWriteFontList::DelayedInitFontList()
LOG_FONTINIT(("Uptime: %9.3f s\n", upTime/1000));
LOG_FONTINIT(("dwrite version: %s\n",
NS_ConvertUTF16toUTF8(dwriteVers).get()));
elapsedTime = (t3.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT((
"Total time in DelayedInitFontList: %9.3f ms (families: %d, %s)\n",
elapsedTime, systemFonts->GetFontFamilyCount(),
(mGDIFontTableAccess ? "gdi table access" : "dwrite table access")));
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT((" --- GetSystemFontCollection: %9.3f ms\n", elapsedTime));
elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart;
LOG_FONTINIT((" --- iterate over families: %9.3f ms\n", elapsedTime));
}
#endif
elapsedTime = (t3.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_TOTAL, elapsedTime);
Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_COUNT,
systemFonts->GetFontFamilyCount());
Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_GDI_TABLE, mGDIFontTableAccess);
LOG_FONTINIT((
"Total time in DelayedInitFontList: %9.3f ms (families: %d, %s)\n",
elapsedTime, systemFonts->GetFontFamilyCount(),
(mGDIFontTableAccess ? "gdi table access" : "dwrite table access")));
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_COLLECT, elapsedTime);
LOG_FONTINIT((" --- GetSystemFontCollection: %9.3f ms\n", elapsedTime));
elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart;
Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_ITERATE, elapsedTime);
LOG_FONTINIT((" --- iterate over families: %9.3f ms\n", elapsedTime));
return NS_OK;
}

Просмотреть файл

@ -60,8 +60,12 @@
#include "nsISimpleEnumerator.h"
#include "nsIWindowsRegKey.h"
#include "mozilla/Telemetry.h"
#include <usp10.h>
using namespace mozilla;
#define ROUND(x) floor((x) + 0.5)
@ -648,6 +652,7 @@ gfxGDIFontList::GetFontSubstitutes()
nsresult
gfxGDIFontList::InitFontList()
{
Telemetry::AutoTimer<Telemetry::GDI_INITFONTLIST_TOTAL> timer;
gfxFontCache *fc = gfxFontCache::GetCache();
if (fc)
fc->AgeAllGenerations();

Просмотреть файл

@ -59,9 +59,13 @@
#include "nsDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/Telemetry.h"
#include <unistd.h>
#include <time.h>
using namespace mozilla;
class nsAutoreleasePool {
public:
nsAutoreleasePool()
@ -717,6 +721,8 @@ gfxMacPlatformFontList::InitFontList()
if (mATSGeneration == currentGeneration)
return NS_OK;
Telemetry::AutoTimer<Telemetry::MAC_INITFONTLIST_TOTAL> timer;
mATSGeneration = currentGeneration;
#ifdef PR_LOGGING
LOG_FONTLIST(("(fontlist) updating to generation: %d", mATSGeneration));

Просмотреть файл

@ -927,7 +927,7 @@ unacceptable performance overhead, so we go with perceptual. */
#define INTENT_MIN 0
#define INTENT_MAX 3
PRBool
int
gfxPlatform::GetRenderingIntent()
{
if (gCMSIntent == -2) {

Просмотреть файл

@ -77,6 +77,7 @@
#include "gfxUnicodeProperties.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
@ -199,6 +200,7 @@ gfxPlatformFontList::InitOtherFamilyNames()
{
mOtherFamilyNamesInitialized = PR_TRUE;
Telemetry::AutoTimer<Telemetry::FONTLIST_INITOTHERFAMILYNAMES> timer;
// iterate over all font families and read in other family names
mFontFamilies.Enumerate(gfxPlatformFontList::InitOtherFamilyNamesProc, this);
}
@ -219,6 +221,7 @@ gfxPlatformFontList::InitFaceNameLists()
mFaceNamesInitialized = PR_TRUE;
// iterate over all font families and read in other family names
Telemetry::AutoTimer<Telemetry::FONTLIST_INITFACENAMELISTS> timer;
mFontFamilies.Enumerate(gfxPlatformFontList::InitFaceNameListsProc, this);
}

Просмотреть файл

@ -238,7 +238,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
PRInt32 mUcs4 = this->mUcs4;
PRUint8 mState = this->mState;
PRUint8 mBytes = this->mBytes;
PRUint8 mFirst = this->mFirst;
PRPackedBool mFirst = this->mFirst;
// Set mFirst to PR_FALSE now so we don't have to every time through the ASCII
// branch within the loop.

Просмотреть файл

@ -92,6 +92,9 @@ MessageLoop::MessageLoop(Type type)
nestable_tasks_allowed_(true),
exception_restoration_(false),
state_(NULL),
#ifdef OS_WIN
os_modal_loop_(false),
#endif // OS_WIN
next_sequence_num_(0) {
DCHECK(!current()) << "should only have one message loop per thread";
lazy_tls_ptr.Pointer()->Set(this);

Просмотреть файл

@ -264,6 +264,16 @@ public:
exception_restoration_ = restore;
}
#if defined(OS_WIN)
void set_os_modal_loop(bool os_modal_loop) {
os_modal_loop_ = os_modal_loop;
}
bool & os_modal_loop() {
return os_modal_loop_;
}
#endif // OS_WIN
//----------------------------------------------------------------------------
protected:
struct RunState {
@ -424,6 +434,12 @@ public:
RunState* state_;
#if defined(OS_WIN)
// Should be set to true before calling Windows APIs like TrackPopupMenu, etc
// which enter a modal message loop.
bool os_modal_loop_;
#endif
// The next sequence number to use for delayed tasks.
int next_sequence_num_;

Просмотреть файл

@ -6,6 +6,7 @@
#include <math.h>
#include "base/message_loop.h"
#include "base/histogram.h"
#include "base/win_util.h"
@ -380,11 +381,18 @@ bool MessagePumpForUI::ProcessPumpReplacementMessage() {
// that the re-post of kMsgHaveWork may be asynchronous to this thread!!
MSG msg;
bool have_message = (0 != PeekMessage(&msg, NULL, 0, 0, PM_REMOVE));
if (have_message && msg.message == WM_NULL)
bool have_message = false;
if (MessageLoop::current()->os_modal_loop()) {
// We only peek out WM_PAINT and WM_TIMER here for reasons mentioned above.
have_message = PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) ||
PeekMessage(&msg, NULL, WM_TIMER, WM_TIMER, PM_REMOVE);
} else {
have_message = (0 != PeekMessage(&msg, NULL, 0, 0, PM_REMOVE));
if (have_message && msg.message == WM_NULL)
have_message = (0 != PeekMessage(&msg, NULL, 0, 0, PM_REMOVE));
}
DCHECK(!have_message || kMsgHaveWork != msg.message ||
msg.hwnd != message_hwnd_);

Просмотреть файл

@ -188,6 +188,7 @@ CPPSRCS = \
Stack.cpp \
String.cpp \
ParseMaps.cpp \
Unicode.cpp \
$(NULL)
# Changes to internal header files, used externally, massively slow down
@ -276,6 +277,7 @@ EXPORTS_vm = \
Stack.h \
String.h \
StringObject.h \
Unicode.h \
$(NULL)
###############################################

Просмотреть файл

@ -0,0 +1,23 @@
function f() {
var args = arguments, r;
for (var i = 0; i < args.length; i++)
r = args[i];
return r;
}
assertEq(f.apply(null, [1, 2, 3, 4, 5, 6]), 6)
assertEq(f.apply(null, [1, 2, 3, 4, 5]), 5)
assertEq(f.apply(null, [1, 2, 3, 4]), 4)
function g(arg) {
var r;
for (var i = 0; i < arg.length; i++)
r = arg[i];
return r;
}
assertEq(g((function () arguments).call(null, 1, 2, 3)), 3);
assertEq(g(new Float32Array(3)), 0.0);
assertEq(g([1, 2, 3, 4]), 4);

Просмотреть файл

@ -550,9 +550,8 @@ date_regionMatches(const char* s1, int s1off, const jschar* s2, int s2off,
while (count > 0 && s1[s1off] && s2[s2off]) {
if (ignoreCase) {
if (JS_TOLOWER((jschar)s1[s1off]) != JS_TOLOWER(s2[s2off])) {
if (unicode::ToLowerCase(s1[s1off]) != unicode::ToLowerCase(s2[s2off]))
break;
}
} else {
if ((jschar)s1[s1off] != s2[s2off]) {
break;

Просмотреть файл

@ -361,7 +361,7 @@ ParseIntStringHelper(JSContext *cx, const jschar *ws, const jschar *end, int may
JS_ASSERT(maybeRadix == 0 || (2 <= maybeRadix && maybeRadix <= 36));
JS_ASSERT(ws <= end);
const jschar *s = js_SkipWhiteSpace(ws, end);
const jschar *s = SkipSpace(ws, end);
JS_ASSERT(ws <= s);
JS_ASSERT(s <= end);
@ -1450,15 +1450,14 @@ JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
const jschar **ep, jsdouble *dp)
{
const jschar *s1;
size_t length, i;
size_t i;
char cbuf[32];
char *cstr, *istr, *estr;
JSBool negative;
jsdouble d;
s1 = js_SkipWhiteSpace(s, send);
length = send - s1;
const jschar *s1 = SkipSpace(s, send);
size_t length = send - s1;
/* Use cbuf to avoid malloc */
if (length >= sizeof cbuf) {

Просмотреть файл

@ -40,7 +40,10 @@
#ifndef jsnuminlines_h___
#define jsnuminlines_h___
#include "jsstr.h"
#include "vm/Unicode.h"
#include "jsstrinlines.h"
namespace js {
@ -71,7 +74,7 @@ StringToNumberType(JSContext *cx, JSString *str, T *result)
*result = NumberTraits<T>::toSelfType(T(c - '0'));
return true;
}
if (JS_ISSPACE(c)) {
if (unicode::IsSpace(c)) {
*result = NumberTraits<T>::toSelfType(T(0));
return true;
}
@ -79,17 +82,15 @@ StringToNumberType(JSContext *cx, JSString *str, T *result)
return true;
}
const jschar *bp = chars;
const jschar *end = chars + length;
bp = js_SkipWhiteSpace(bp, end);
const jschar *bp = SkipSpace(chars, end);
/* ECMA doesn't allow signed hex numbers (bug 273467). */
if (end - bp >= 2 && bp[0] == '0' && (bp[1] == 'x' || bp[1] == 'X')) {
/* Looks like a hex number. */
const jschar *endptr;
double d;
if (!GetPrefixInteger(cx, bp + 2, end, 16, &endptr, &d) ||
js_SkipWhiteSpace(endptr, end) != end) {
if (!GetPrefixInteger(cx, bp + 2, end, 16, &endptr, &d) || SkipSpace(endptr, end) != end) {
*result = NumberTraits<T>::NaN();
return true;
}
@ -106,7 +107,7 @@ StringToNumberType(JSContext *cx, JSString *str, T *result)
*/
const jschar *ep;
double d;
if (!js_strtod(cx, bp, end, &ep, &d) || js_SkipWhiteSpace(ep, end) != end) {
if (!js_strtod(cx, bp, end, &ep, &d) || SkipSpace(ep, end) != end) {
*result = NumberTraits<T>::NaN();
return true;
}

Просмотреть файл

@ -1187,7 +1187,9 @@ struct JSObject : js::gc::Cell {
bool defaultValue(JSContext *cx, JSType hint, js::Value *vp) {
js::ConvertOp op = getClass()->convert;
return (op == js::ConvertStub ? js::DefaultValue : op)(cx, this, hint, vp);
bool ok = (op == js::ConvertStub ? js::DefaultValue : op)(cx, this, hint, vp);
JS_ASSERT_IF(ok, vp->isPrimitive());
return ok;
}
JSType typeOf(JSContext *cx) {

Просмотреть файл

@ -779,8 +779,7 @@ QuoteString(Sprinter *sp, JSString *str, uint32 quote)
for (const jschar *t = s; t < z; s = ++t) {
/* Move t forward from s past un-quote-worthy characters. */
jschar c = *t;
while (JS_ISPRINT(c) && c != qc && c != '\\' && c != '\t' &&
!(c >> 8)) {
while (c < 127 && isprint(c) && c != qc && c != '\\' && c != '\t') {
c = *++t;
if (t == z)
break;

Просмотреть файл

@ -79,6 +79,7 @@
#endif
using namespace js;
using namespace js::unicode;
#define JS_KEYWORD(keyword, type, op, version) \
const char js_##keyword##_str[] = #keyword;
@ -142,12 +143,12 @@ js_IsIdentifier(JSLinearString *str)
if (length == 0)
return JS_FALSE;
jschar c = *chars;
if (!JS_ISIDSTART(c))
if (!IsIdentifierStart(c))
return JS_FALSE;
const jschar *end = chars + length;
while (++chars != end) {
c = *chars;
if (!JS_ISIDENT(c))
if (!IsIdentifierPart(c))
return JS_FALSE;
}
return JS_TRUE;
@ -657,7 +658,7 @@ TokenStream::getXMLEntity()
if (length > 2 && bp[1] == '#') {
/* Match a well-formed XML Character Reference. */
i = 2;
if (length > 3 && JS_TOLOWER(bp[i]) == 'x') {
if (length > 3 && (bp[i] == 'x' || bp[i] == 'X')) {
if (length > 9) /* at most 6 hex digits allowed */
goto badncr;
while (++i < length) {
@ -765,7 +766,7 @@ TokenStream::getXMLTextOrTag(TokenKind *ttp, Token **tpp)
continue;
}
if (!JS_ISXMLSPACE(c))
if (!IsXMLSpace(c))
tt = TOK_XMLTEXT;
if (!tokenbuf.append(c))
goto error;
@ -792,10 +793,12 @@ TokenStream::getXMLTextOrTag(TokenKind *ttp, Token **tpp)
JS_ASSERT(flags & TSF_XMLTAGMODE);
tp = newToken(0);
c = getChar();
if (JS_ISXMLSPACE(c)) {
if (c != EOF && IsXMLSpace(c)) {
do {
c = getChar();
} while (JS_ISXMLSPACE(c));
if (c == EOF)
break;
} while (IsXMLSpace(c));
ungetChar(c);
tp->pos.end.lineno = lineno;
tt = TOK_XMLSPACE;
@ -808,19 +811,19 @@ TokenStream::getXMLTextOrTag(TokenKind *ttp, Token **tpp)
}
tokenbuf.clear();
if (JS_ISXMLNSSTART(c)) {
if (IsXMLNamespaceStart(c)) {
JSBool sawColon = JS_FALSE;
if (!tokenbuf.append(c))
goto error;
while ((c = getChar()) != EOF && JS_ISXMLNAME(c)) {
while ((c = getChar()) != EOF && IsXMLNamePart(c)) {
if (c == ':') {
int nextc;
if (sawColon ||
(nextc = peekChar(),
((flags & TSF_XMLONLYMODE) || nextc != '{') &&
!JS_ISXMLNAME(nextc))) {
!IsXMLNamePart(nextc))) {
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR,
JSMSG_BAD_XML_QNAME);
goto error;
@ -1024,20 +1027,20 @@ TokenStream::getXMLMarkup(TokenKind *ttp, Token **tpp)
if (c == EOF)
goto bad_xml_markup;
if (inTarget) {
if (JS_ISXMLSPACE(c)) {
if (IsXMLSpace(c)) {
if (tokenbuf.empty())
goto bad_xml_markup;
inTarget = JS_FALSE;
} else {
if (!(tokenbuf.empty()
? JS_ISXMLNSSTART(c)
: JS_ISXMLNS(c))) {
? IsXMLNamespaceStart(c)
: IsXMLNamespacePart(c))) {
goto bad_xml_markup;
}
++targetLength;
}
} else {
if (contentIndex < 0 && !JS_ISXMLSPACE(c))
if (contentIndex < 0 && !IsXMLSpace(c))
contentIndex = tokenbuf.length();
}
if (!tokenbuf.append(c))
@ -1112,7 +1115,7 @@ TokenStream::peekUnicodeEscape(int *result)
bool
TokenStream::matchUnicodeEscapeIdStart(int32 *cp)
{
if (peekUnicodeEscape(cp) && JS_ISIDSTART(*cp)) {
if (peekUnicodeEscape(cp) && IsIdentifierStart(*cp)) {
skipChars(5);
return true;
}
@ -1122,7 +1125,7 @@ TokenStream::matchUnicodeEscapeIdStart(int32 *cp)
bool
TokenStream::matchUnicodeEscapeIdent(int32 *cp)
{
if (peekUnicodeEscape(cp) && JS_ISIDENT(*cp)) {
if (peekUnicodeEscape(cp) && IsIdentifierPart(*cp)) {
skipChars(5);
return true;
}
@ -1149,7 +1152,7 @@ TokenStream::getAtLine()
cp[3] == 'n' &&
cp[4] == 'e') {
skipChars(5);
while ((c = getChar()) != '\n' && JS_ISSPACE_OR_BOM((jschar)c))
while ((c = getChar()) != '\n' && c != EOF && IsSpaceOrBOM2(c))
continue;
if (JS7_ISDEC(c)) {
line = JS7_UNDEC(c);
@ -1161,7 +1164,7 @@ TokenStream::getAtLine()
}
line = temp;
}
while (c != '\n' && JS_ISSPACE_OR_BOM((jschar)c))
while (c != '\n' && c != EOF && IsSpaceOrBOM2(c))
c = getChar();
i = 0;
if (c == '"') {
@ -1175,10 +1178,8 @@ TokenStream::getAtLine()
filenameBuf[i++] = (char) c;
}
if (c == '"') {
while ((c = getChar()) != '\n' &&
JS_ISSPACE_OR_BOM((jschar)c)) {
while ((c = getChar()) != '\n' && c != EOF && IsSpaceOrBOM2(c))
continue;
}
}
}
filenameBuf[i] = '\0';
@ -1259,7 +1260,7 @@ TokenStream::putIdentInTokenbuf(const jschar *identStart)
tokenbuf.clear();
for (;;) {
c = getCharIgnoreEOL();
if (!JS_ISIDENT(c)) {
if (!IsIdentifierPart(c)) {
if (c != '\\' || !matchUnicodeEscapeIdent(&qc))
break;
c = qc;
@ -1356,13 +1357,14 @@ TokenStream::getTokenInternal()
}
c = userbuf.getRawChar();
JS_ASSERT(c != EOF);
/*
* Chars not in the range 0..127 are rare. Getting them out of the way
* early allows subsequent checking to be faster.
*/
if (JS_UNLIKELY(c >= 128)) {
if (JS_ISSPACE_OR_BOM(c)) {
if (IsSpaceOrBOM2(c)) {
if (c == LINE_SEPARATOR || c == PARA_SEPARATOR) {
updateLineInfoForEOL();
updateFlagsForEOL();
@ -1373,7 +1375,9 @@ TokenStream::getTokenInternal()
tp = newToken(-1);
if (JS_ISLETTER(c)) {
/* '$' and '_' don't pass IsLetter, but they're < 128 so never appear here. */
JS_STATIC_ASSERT('$' < 128 && '_' < 128);
if (IsLetter(c)) {
identStart = userbuf.addressOfNextRawChar() - 1;
hadUnicodeEscape = false;
goto identifier;
@ -1428,7 +1432,9 @@ TokenStream::getTokenInternal()
identifier:
for (;;) {
c = getCharIgnoreEOL();
if (!JS_ISIDENT(c)) {
if (c == EOF)
break;
if (!IsIdentifierPart(c)) {
if (c != '\\' || !matchUnicodeEscapeIdent(&qc))
break;
hadUnicodeEscape = true;
@ -1670,7 +1676,7 @@ TokenStream::getTokenInternal()
}
ungetCharIgnoreEOL(c);
if (JS_ISIDSTART(c)) {
if (c != EOF && IsIdentifierStart(c)) {
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_IDSTART_AFTER_NUMBER);
goto error;
}
@ -1766,7 +1772,7 @@ TokenStream::getTokenInternal()
}
ungetCharIgnoreEOL(c);
if (JS_ISIDSTART(c)) {
if (c != EOF && IsIdentifierStart(c)) {
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_IDSTART_AFTER_NUMBER);
goto error;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -49,6 +49,8 @@
#include "jsvalue.h"
#include "jscell.h"
#include "vm/Unicode.h"
namespace js {
/* Implemented in jsstrinlines.h */
@ -88,160 +90,6 @@ struct JSSubString {
extern jschar js_empty_ucstr[];
extern JSSubString js_EmptySubString;
/* Unicode character attribute lookup tables. */
extern const uint8 js_X[];
extern const uint8 js_Y[];
extern const uint32 js_A[];
/* Enumerated Unicode general category types. */
typedef enum JSCharType {
JSCT_UNASSIGNED = 0,
JSCT_UPPERCASE_LETTER = 1,
JSCT_LOWERCASE_LETTER = 2,
JSCT_TITLECASE_LETTER = 3,
JSCT_MODIFIER_LETTER = 4,
JSCT_OTHER_LETTER = 5,
JSCT_NON_SPACING_MARK = 6,
JSCT_ENCLOSING_MARK = 7,
JSCT_COMBINING_SPACING_MARK = 8,
JSCT_DECIMAL_DIGIT_NUMBER = 9,
JSCT_LETTER_NUMBER = 10,
JSCT_OTHER_NUMBER = 11,
JSCT_SPACE_SEPARATOR = 12,
JSCT_LINE_SEPARATOR = 13,
JSCT_PARAGRAPH_SEPARATOR = 14,
JSCT_CONTROL = 15,
JSCT_FORMAT = 16,
JSCT_PRIVATE_USE = 18,
JSCT_SURROGATE = 19,
JSCT_DASH_PUNCTUATION = 20,
JSCT_START_PUNCTUATION = 21,
JSCT_END_PUNCTUATION = 22,
JSCT_CONNECTOR_PUNCTUATION = 23,
JSCT_OTHER_PUNCTUATION = 24,
JSCT_MATH_SYMBOL = 25,
JSCT_CURRENCY_SYMBOL = 26,
JSCT_MODIFIER_SYMBOL = 27,
JSCT_OTHER_SYMBOL = 28
} JSCharType;
/* Character classifying and mapping macros, based on java.lang.Character. */
#define JS_CCODE(c) (js_A[js_Y[(js_X[(uint16)(c)>>6]<<6)|((c)&0x3F)]])
#define JS_CTYPE(c) (JS_CCODE(c) & 0x1F)
#define JS_ISALPHA(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER)) \
>> JS_CTYPE(c)) & 1)
#define JS_ISALNUM(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER)) \
>> JS_CTYPE(c)) & 1)
/* A unicode letter, suitable for use in an identifier. */
#define JS_ISLETTER(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER)) \
>> JS_CTYPE(c)) & 1)
/*
* 'IdentifierPart' from ECMA grammar, is Unicode letter or combining mark or
* digit or connector punctuation.
*/
#define JS_ISIDPART(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER) | \
(1 << JSCT_NON_SPACING_MARK) | \
(1 << JSCT_COMBINING_SPACING_MARK) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER) | \
(1 << JSCT_CONNECTOR_PUNCTUATION)) \
>> JS_CTYPE(c)) & 1)
/* Unicode control-format characters, ignored in input */
#define JS_ISFORMAT(c) (((1 << JSCT_FORMAT) >> JS_CTYPE(c)) & 1)
extern const bool js_isidstart[];
extern const bool js_isident[];
static inline bool
JS_ISIDSTART(int c)
{
unsigned w = c;
return (w < 128) ? js_isidstart[w] : JS_ISLETTER(c);
}
static inline bool
JS_ISIDENT(int c)
{
unsigned w = c;
return (w < 128) ? js_isident[w] : JS_ISIDPART(c);
}
#define JS_ISXMLSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || \
(c) == '\n')
#define JS_ISXMLNSSTART(c) ((JS_CCODE(c) & 0x00000100) || (c) == '_')
#define JS_ISXMLNS(c) ((JS_CCODE(c) & 0x00000080) || (c) == '.' || \
(c) == '-' || (c) == '_')
#define JS_ISXMLNAMESTART(c) (JS_ISXMLNSSTART(c) || (c) == ':')
#define JS_ISXMLNAME(c) (JS_ISXMLNS(c) || (c) == ':')
#define JS_ISDIGIT(c) (JS_CTYPE(c) == JSCT_DECIMAL_DIGIT_NUMBER)
const jschar BYTE_ORDER_MARK = 0xFEFF;
const jschar BYTE_ORDER_MARK2 = 0xFFFE;
const jschar NO_BREAK_SPACE = 0x00A0;
extern const bool js_isspace[];
static inline bool
JS_ISSPACE(int c)
{
unsigned w = c;
return (w < 128)
? js_isspace[w]
: w == NO_BREAK_SPACE || w == BYTE_ORDER_MARK ||
(JS_CCODE(w) & 0x00070000) == 0x00040000;
}
static inline bool
JS_ISSPACE_OR_BOM(int c)
{
unsigned w = c;
/* Treat little- and big-endian BOMs as whitespace for compatibility. */
return (w < 128)
? js_isspace[w]
: w == NO_BREAK_SPACE || w == BYTE_ORDER_MARK || w == BYTE_ORDER_MARK2 ||
(JS_CCODE(w) & 0x00070000) == 0x00040000;
}
#define JS_ISPRINT(c) ((c) < 128 && isprint(c))
#define JS_ISUPPER(c) (JS_CTYPE(c) == JSCT_UPPERCASE_LETTER)
#define JS_ISLOWER(c) (JS_CTYPE(c) == JSCT_LOWERCASE_LETTER)
#define JS_TOUPPER(c) ((jschar) ((JS_CCODE(c) & 0x00100000) \
? (c) - ((int32)JS_CCODE(c) >> 22) \
: (c)))
#define JS_TOLOWER(c) ((jschar) ((JS_CCODE(c) & 0x00200000) \
? (c) + ((int32)JS_CCODE(c) >> 22) \
: (c)))
/*
* Shorthands for ASCII (7-bit) decimal and hex conversion.
* Manually inline isdigit for performance; MSVC doesn't do this for us.
@ -391,18 +239,6 @@ js_strchr_limit(const jschar *s, jschar c, const jschar *limit);
#define js_strncpy(t, s, n) memcpy((t), (s), (n) * sizeof(jschar))
/*
* Return s advanced past any Unicode white space characters.
*/
static inline const jschar *
js_SkipWhiteSpace(const jschar *s, const jschar *end)
{
JS_ASSERT(s <= end);
while (s != end && JS_ISSPACE(*s))
s++;
return s;
}
namespace js {
/*

Просмотреть файл

@ -325,6 +325,20 @@ class StringSegmentRange
}
};
/*
* Return s advanced past any Unicode white space characters.
*/
static inline const jschar *
SkipSpace(const jschar *s, const jschar *end)
{
JS_ASSERT(s <= end);
while (s < end && unicode::IsSpace(*s))
s++;
return s;
}
} /* namespace js */
#endif /* jsstrinlines_h___ */

Просмотреть файл

@ -8992,7 +8992,7 @@ EvalCmp(JSContext *cx, LOpcode op, JSString* l, JSString* r, JSBool *ret)
{
if (op == LIR_eqd)
return EqualStrings(cx, l, r, ret);
JSBool cmp;
int32 cmp;
if (!CompareStrings(cx, l, r, &cmp))
return false;
*ret = EvalCmp(op, cmp, 0);

Просмотреть файл

@ -545,10 +545,10 @@ IsXMLName(const jschar *cp, size_t n)
jschar c;
rv = JS_FALSE;
if (n != 0 && JS_ISXMLNSSTART(*cp)) {
if (n != 0 && unicode::IsXMLNamespaceStart(*cp)) {
while (--n != 0) {
c = *++cp;
if (!JS_ISXMLNS(c))
if (!unicode::IsXMLNamespacePart(c))
return rv;
}
rv = JS_TRUE;
@ -1134,14 +1134,20 @@ static JSPropertySpec xml_static_props[] = {
#define IS_XMLNS(str) \
(str->length() == 5 && IS_XMLNS_CHARS(str->chars()))
#define IS_XML_CHARS(chars) \
(JS_TOLOWER((chars)[0]) == 'x' && \
JS_TOLOWER((chars)[1]) == 'm' && \
JS_TOLOWER((chars)[2]) == 'l')
static inline bool
IS_XML_CHARS(const jschar *chars)
{
return (chars[0] == 'x' || chars[0] == 'X') &&
(chars[1] == 'm' || chars[1] == 'M') &&
(chars[2] == 'l' || chars[2] == 'L');
}
#define HAS_NS_AFTER_XML(chars) \
(JS_TOLOWER((chars)[3]) == 'n' && \
JS_TOLOWER((chars)[4]) == 's')
static inline bool
HAS_NS_AFTER_XML(const jschar *chars)
{
return (chars[3] == 'n' || chars[3] == 'N') &&
(chars[4] == 's' || chars[4] == 'S');
}
#define IS_XMLNS_CHARS(chars) \
(IS_XML_CHARS(chars) && HAS_NS_AFTER_XML(chars))
@ -1263,12 +1269,12 @@ ChompXMLWhitespace(JSContext *cx, JSString *str)
for (cp = start, end = cp + length; cp < end; cp++) {
c = *cp;
if (!JS_ISXMLSPACE(c))
if (!unicode::IsXMLSpace(c))
break;
}
while (end > cp) {
c = end[-1];
if (!JS_ISXMLSPACE(c))
if (!unicode::IsXMLSpace(c))
break;
--end;
}

365
js/src/make_unicode.py Normal file
Просмотреть файл

@ -0,0 +1,365 @@
# -*- coding: utf-8 -*-
# Based upon makeunicodedata.py
# (http://hg.python.org/cpython/file/c8192197d23d/Tools/unicode/makeunicodedata.py)
# written by Fredrik Lundh (fredrik@pythonware.com)
#
# Copyright (C) 2011 Tom Schuster <evilpies@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
import csv
import sys
# ECMAScript 5 $ 7.2
whitespace = [
# python doesn't support using control character names :(
0x9, # CHARACTER TABULATION
0xb, # LINE TABULATION
0xc, # FORM FEED
ord(u'\N{SPACE}'),
ord(u'\N{NO-BREAK SPACE}'),
ord(u'\N{ZERO WIDTH NO-BREAK SPACE}'), # also BOM
]
# $ 7.3
line_terminator = [
0xa, # LINE FEED
0xd, # CARRIAGE RETURN
ord(u'\N{LINE SEPARATOR}'),
ord(u'\N{PARAGRAPH SEPARATOR}'),
]
# These are also part of IdentifierPart $7.6
ZWNJ = ord(u'\N{ZERO WIDTH NON-JOINER}')
ZWJ = ord(u'\N{ZERO WIDTH JOINER}')
FLAG_SPACE = 1 << 0
FLAG_LETTER = 1 << 1
FLAG_IDENTIFIER_PART = 1 << 2
FLAG_NO_DELTA = 1 << 3
FLAG_ENCLOSING_MARK = 1 << 4
FLAG_COMBINING_SPACING_MARK = 1 << 5
MAX = 0xffff
public_domain = """
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
"""
def generate_unicode_stuff(unicode_data, data_file, test_mapping, test_space):
reader = csv.reader(unicode_data, delimiter=';')
dummy = (0, 0, 0)
table = [dummy]
cache = {dummy: 0}
index = [0] * (MAX + 1)
test_table = {}
test_space_table = []
for row in reader:
code_point = row[0]
name = row[1]
category = row[2]
alias = row[-5]
uppercase = row[-3]
lowercase = row[-2]
code = int(code_point, 16)
flags = 0
if code > MAX:
break
# we combine whitespace and lineterminators because in pratice we don't need them separated
if category == 'Zs' or code in whitespace or code in line_terminator:
flags |= FLAG_SPACE
test_space_table.append(code)
if category in ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl']: # $ 7.6 (UnicodeLetter)
flags |= FLAG_LETTER
if category in ['Mn', 'Mc', 'Nd', 'Pc'] or code == ZWNJ or code == ZWJ: # $ 7.6 (IdentifierPart)
flags |= FLAG_IDENTIFIER_PART
if category == 'Me':
flags |= FLAG_ENCLOSING_MARK
if category == 'Mc':
flags |= FLAG_COMBINING_SPACING_MARK
if uppercase:
upper = int(uppercase, 16)
else:
upper = code
if lowercase:
lower = int(lowercase, 16)
else:
lower = code
test_table[code] = (upper, lower, name, alias)
up_d = upper - code
low_d = lower - code
if -32768 <= up_d <= 32767 and -32768 <= low_d <= 32767:
upper = up_d & 0xffff
lower = low_d & 0xffff
else:
flags |= FLAG_NO_DELTA
item = (upper, lower, flags)
i = cache.get(item)
if i is None:
assert item not in table
cache[item] = i = len(table)
table.append(item)
index[code] = i
test_mapping.write('/* Generated by make_unicode.py DO NOT MODIFY */\n')
test_mapping.write(public_domain)
test_mapping.write('var mapping = [\n')
for code in range(0, MAX + 1):
entry = test_table.get(code)
if entry:
upper, lower, name, alias = entry
test_mapping.write(' [' + hex(upper) + ', ' + hex(lower) + '], /* ' +
name + (' (' + alias + ')' if alias else '') + ' */\n')
else:
test_mapping.write(' [' + hex(code) + ', ' + hex(code) + '],\n')
test_mapping.write('];')
test_mapping.write("""
assertEq(mapping.length, 0x10000);
for (var i = 0; i <= 0xffff; i++) {
var char = String.fromCharCode(i);
var info = mapping[i];
assertEq(char.toUpperCase().charCodeAt(0), info[0]);
assertEq(char.toLowerCase().charCodeAt(0), info[1]);
}
if (typeof reportCompare === "function")
reportCompare(true, true);
""")
test_space.write('/* Generated by make_unicode.py DO NOT MODIFY */\n')
test_space.write(public_domain)
test_space.write('var onlySpace = String.fromCharCode(' +
', '.join(map(lambda c: hex(c), test_space_table)) + ');\n')
test_space.write("""
assertEq(onlySpace.trim(), "");
assertEq((onlySpace + 'aaaa').trim(), 'aaaa');
assertEq(('aaaa' + onlySpace).trim(), 'aaaa');
assertEq((onlySpace + 'aaaa' + onlySpace).trim(), 'aaaa');
if (typeof reportCompare === "function")
reportCompare(true, true);
""")
index1, index2, shift = splitbins(index)
# Don't forget to update CharInfo in Unicode.cpp if you need to change this
assert shift == 6
# verify correctness
for char in index:
test = table[index[char]]
idx = index1[char >> shift]
idx = index2[(idx << shift) + (char & ((1 << shift) - 1))]
assert test == table[idx]
print(len(index2))
comment = """
/*
* So how does indexing work?
* First let's have a look at a jschar, 16-bits:
* [................]
* Step 1:
* Extracting the upper 10 bits from the jschar.
* upper = char >> 6 ([**********......])
* Step 2:
* Using these bits to get an reduced index from index1.
* index = index1[upper]
* Step 3:
* Combining the index and the bottom 6 bits of the orginial jschar.
* real_index = index2[(index << 6) + (jschar & 0x3f)] ([..********++++++])
*
* The advantage here is that the bigest number in index1 doesn't need 10 bits,
* but 8 and we save some memory.
*
* Step 4:
* Get the character informations by looking up real_index in js_charinfo.
*
* Pseudocode of generation:
*
* let table be the mapping of jschar => js_charinfo_index
* let index1 be an empty array
* let index2 be an empty array
* let cache be a hash map
*
* while shift is less then maximal amount you can shift 0xffff before it's 0
* let chunks be table split in chunks of size 2**shift
*
* for every chunk in chunks
* if chunk is in cache
* let index be cache[chunk]
* else
* let index be the max key of index2 + 1
* for element in chunk
* push element to index2
* put index as chunk in cache
*
* push index >> shift to index1
*
* increase shift
* stop if you found the best shift
*/
"""
data_file.write('/* Generated by make_unicode.py DO NOT MODIFY */\n')
data_file.write(public_domain)
data_file.write('#include "Unicode.h"\n\n')
data_file.write('namespace js {\n')
data_file.write('namespace unicode {\n')
data_file.write(comment)
data_file.write('const CharacterInfo js_charinfo[] = {\n')
for d in table:
data_file.write(' {')
data_file.write(', '.join((str(e) for e in d)))
data_file.write('},\n')
data_file.write('};\n')
data_file.write('\n')
def dump(data, name, file):
file.write('const uint16 ' + name + '[] = {\n')
line = pad = ' ' * 4
lines = []
for entry in data:
s = str(entry)
assert len(s) <= 3
s = s.rjust(3)
if len(line + s) + 5 > 99:
lines.append(line.rstrip())
line = pad + s + ', '
else:
line = line + s + ', '
lines.append(line.rstrip())
file.write('\n'.join(lines))
file.write('\n};\n')
dump(index1, 'index1', data_file)
data_file.write('\n')
dump(index2, 'index2', data_file)
data_file.write('\n')
data_file.write('} /* namespace unicode */\n')
data_file.write('} /* namespace js */\n')
data_file.write('\n')
def getsize(data):
""" return smallest possible integer size for the given array """
maxdata = max(data)
assert maxdata < 2**32
if maxdata < 256:
return 1
elif maxdata < 65536:
return 2
else:
return 4
def splitbins(t):
"""t -> (t1, t2, shift). Split a table to save space.
t is a sequence of ints. This function can be useful to save space if
many of the ints are the same. t1 and t2 are lists of ints, and shift
is an int, chosen to minimize the combined size of t1 and t2 (in C
code), and where for each i in range(len(t)),
t[i] == t2[(t1[i >> shift] << shift) + (i & mask)]
where mask is a bitmask isolating the last "shift" bits.
"""
def dump(t1, t2, shift, bytes):
print("%d+%d bins at shift %d; %d bytes" % (
len(t1), len(t2), shift, bytes), file=sys.stderr)
print("Size of original table:", len(t)*getsize(t), \
"bytes", file=sys.stderr)
n = len(t)-1 # last valid index
maxshift = 0 # the most we can shift n and still have something left
if n > 0:
while n >> 1:
n >>= 1
maxshift += 1
del n
bytes = sys.maxsize # smallest total size so far
t = tuple(t) # so slices can be dict keys
for shift in range(maxshift + 1):
t1 = []
t2 = []
size = 2**shift
bincache = {}
for i in range(0, len(t), size):
bin = t[i:i + size]
index = bincache.get(bin)
if index is None:
index = len(t2)
bincache[bin] = index
t2.extend(bin)
t1.append(index >> shift)
# determine memory size
b = len(t1) * getsize(t1) + len(t2) * getsize(t2)
if b < bytes:
best = t1, t2, shift
bytes = b
t1, t2, shift = best
print("Best:", end=' ', file=sys.stderr)
dump(t1, t2, shift, bytes)
# exhaustively verify that the decomposition is correct
mask = 2**shift - 1
for i in range(len(t)):
assert t[i] == t2[(t1[i >> shift] << shift) + (i & mask)]
return best
if __name__ == '__main__':
import urllib2
if len(sys.argv) > 1:
print('Always make sure you have the newest UnicodeData.txt!')
unicode_data = open(sys.argv[1], 'r')
else:
print('Downloading...')
reader = urllib2.urlopen('http://unicode.org/Public/UNIDATA/UnicodeData.txt')
data = reader.read()
reader.close()
unicode_data = open('UnicodeData.txt', 'w+')
unicode_data.write(data)
unicode_data.seek(0)
print('Generating...')
generate_unicode_stuff(unicode_data,
open('vm/Unicode.cpp', 'w'),
open('tests/ecma_5/String/string-upper-lower-mapping.js', 'w'),
open('tests/ecma_5/String/string-space-trim.js', 'w'))

Просмотреть файл

@ -2297,6 +2297,154 @@ GetElementIC::attachGetProp(JSContext *cx, JSObject *obj, const Value &v, jsid i
return Lookup_Cacheable;
}
LookupStatus
GetElementIC::attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp)
{
if (!v.isInt32())
return disable(cx, "arguments object with non-integer key");
if (op == JSOP_CALLELEM)
return disable(cx, "arguments object with call");
JS_ASSERT(hasInlineTypeGuard() || idRemat.knownType() == JSVAL_TYPE_INT32);
Assembler masm;
Jump claspGuard = masm.testObjClass(Assembler::NotEqual, objReg, obj->getClass());
masm.move(objReg, typeReg);
masm.load32(Address(objReg, JSObject::getFixedSlotOffset(ArgumentsObject::INITIAL_LENGTH_SLOT)),
objReg);
Jump overridden = masm.branchTest32(Assembler::NonZero, objReg,
Imm32(ArgumentsObject::LENGTH_OVERRIDDEN_BIT));
masm.rshift32(Imm32(ArgumentsObject::PACKED_BITS_COUNT), objReg);
Jump outOfBounds;
if (idRemat.isConstant()) {
outOfBounds = masm.branch32(Assembler::BelowOrEqual, objReg, Imm32(v.toInt32()));
} else {
outOfBounds = masm.branch32(Assembler::BelowOrEqual, objReg, idRemat.dataReg());
}
masm.loadPayload(Address(typeReg, JSObject::getFixedSlotOffset(ArgumentsObject::DATA_SLOT)), objReg);
if (idRemat.isConstant()) {
Address slot(objReg, offsetof(ArgumentsData, slots) + v.toInt32() * sizeof(Value));
masm.loadTypeTag(slot, objReg);
} else {
BaseIndex slot(objReg, idRemat.dataReg(), Assembler::JSVAL_SCALE,
offsetof(ArgumentsData, slots));
masm.loadTypeTag(slot, objReg);
}
Jump holeCheck = masm.branchPtr(Assembler::Equal, objReg, ImmType(JSVAL_TYPE_MAGIC));
Address privateData(typeReg, offsetof(JSObject, privateData));
Jump liveArguments = masm.branchPtr(Assembler::NotEqual, privateData, ImmPtr(0));
masm.loadPrivate(Address(typeReg, JSObject::getFixedSlotOffset(ArgumentsObject::DATA_SLOT)), objReg);
if (idRemat.isConstant()) {
Address slot(objReg, offsetof(ArgumentsData, slots) + v.toInt32() * sizeof(Value));
masm.loadValueAsComponents(slot, typeReg, objReg);
} else {
BaseIndex slot(objReg, idRemat.dataReg(), Assembler::JSVAL_SCALE,
offsetof(ArgumentsData, slots));
masm.loadValueAsComponents(slot, typeReg, objReg);
}
Jump done = masm.jump();
liveArguments.linkTo(masm.label(), &masm);
masm.loadPtr(privateData, typeReg);
Address fun(typeReg, StackFrame::offsetOfExec());
masm.loadPtr(fun, objReg);
Address nargs(objReg, offsetof(JSFunction, nargs));
masm.load16(nargs, objReg);
Jump notFormalArg;
if (idRemat.isConstant())
notFormalArg = masm.branch32(Assembler::BelowOrEqual, objReg, Imm32(v.toInt32()));
else
notFormalArg = masm.branch32(Assembler::BelowOrEqual, objReg, idRemat.dataReg());
masm.lshift32(Imm32(3), objReg); /* nargs << 3 == nargs * sizeof(Value) */
masm.subPtr(objReg, typeReg); /* fp - numFormalArgs => start of formal args */
Label loadFromStack = masm.label();
masm.move(typeReg, objReg);
if (idRemat.isConstant()) {
Address frameEntry(objReg, v.toInt32() * sizeof(Value));
masm.loadValueAsComponents(frameEntry, typeReg, objReg);
} else {
BaseIndex frameEntry(objReg, idRemat.dataReg(), Assembler::JSVAL_SCALE);
masm.loadValueAsComponents(frameEntry, typeReg, objReg);
}
Jump done2 = masm.jump();
notFormalArg.linkTo(masm.label(), &masm);
masm.push(typeReg);
Address argsObject(typeReg, StackFrame::offsetOfArgs());
masm.loadPtr(argsObject, typeReg);
masm.load32(Address(typeReg, JSObject::getFixedSlotOffset(ArgumentsObject::INITIAL_LENGTH_SLOT)),
typeReg);
masm.rshift32(Imm32(ArgumentsObject::PACKED_BITS_COUNT), typeReg);
/* This bascially does fp - (numFormalArgs + numActualArgs + 2) */
masm.addPtr(typeReg, objReg);
masm.addPtr(Imm32(2), objReg);
masm.lshiftPtr(Imm32(3), objReg);
masm.pop(typeReg);
masm.subPtr(objReg, typeReg);
masm.jump(loadFromStack);
PICLinker buffer(masm, *this);
if (!buffer.init(cx))
return error(cx);
if (!buffer.verifyRange(cx->fp()->jit()))
return disable(cx, "code memory is out of range");
buffer.link(claspGuard, slowPathStart);
buffer.link(overridden, slowPathStart);
buffer.link(outOfBounds, slowPathStart);
buffer.link(holeCheck, slowPathStart);
buffer.link(done, fastPathRejoin);
buffer.link(done2, fastPathRejoin);
CodeLocationLabel cs = buffer.finalizeCodeAddendum();
JaegerSpew(JSpew_PICs, "generated getelem arguments stub at %p\n", cs.executableAddress());
Repatcher repatcher(cx->fp()->jit());
repatcher.relink(fastPathStart.jumpAtOffset(inlineClaspGuard), cs);
JS_ASSERT(!shouldPatchUnconditionalClaspGuard());
JS_ASSERT(!inlineClaspGuardPatched);
inlineClaspGuardPatched = true;
stubsGenerated++;
if (stubsGenerated == MAX_GETELEM_IC_STUBS)
disable(cx, "max stubs reached");
disable(cx, "generated arguments stub");
if (!obj->getProperty(cx, id, vp))
return Lookup_Error;
return Lookup_Cacheable;
}
#if defined JS_POLYIC_TYPED_ARRAY
LookupStatus
GetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp)

Просмотреть файл

@ -296,6 +296,8 @@ struct GetElementIC : public BasePolyIC {
LookupStatus update(JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp);
LookupStatus attachGetProp(JSContext *cx, JSObject *obj, const Value &v, jsid id,
Value *vp);
LookupStatus attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid id,
Value *vp);
LookupStatus attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsid id,
Value *vp);
LookupStatus disable(JSContext *cx, const char *reason);

Просмотреть файл

@ -816,7 +816,7 @@ template void JS_FASTCALL stubs::DefFun<false>(VMFrame &f, JSFunction *fun);
THROWV(JS_FALSE); \
if (lval.isString() && rval.isString()) { \
JSString *l = lval.toString(), *r = rval.toString(); \
JSBool cmp; \
int32 cmp; \
if (!CompareStrings(cx, l, r, &cmp)) \
THROWV(JS_FALSE); \
cond = cmp OP 0; \

Просмотреть файл

@ -5150,7 +5150,7 @@ its_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
{
if (its_noisy)
fprintf(gOutFile, "converting it to %s type\n", JS_GetTypeName(cx, type));
return JS_TRUE;
return JS_ConvertStub(cx, obj, type, vp);
}
static void

Просмотреть файл

@ -1,514 +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 Communicator client code, released
* March 31, 1998.
*
* 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 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 ***** */
/**
File Name: 15.5.4.11-2.js
ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
Description:
Returns a string equal in length to the length of the result of converting
this object to a string. The result is a string value, not a String object.
Every character of the result is equal to the corresponding character of the
string, unless that character has a Unicode 2.0 uppercase equivalent, in which
case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
mapping shall be used, which does not depend on implementation or locale.)
Note that the toLowerCase function is intentionally generic; it does not require
that its this value be a String object. Therefore it can be transferred to other
kinds of objects for use as a method.
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "15.5.4.11-2";
var VERSION = "ECMA_1";
startTest();
var TITLE = "String.prototype.toLowerCase()";
writeHeaderToLog( SECTION + " "+ TITLE);
// Georgian
// Range: U+10A0 to U+10FF
for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
var U = new Unicode( i );
/*
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
String.fromCharCode(U.lower),
eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
U.lower,
eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
test();
function MyObject( value ) {
this.value = value;
this.substring = String.prototype.substring;
this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
u = GetUnicodeValues( c );
this.upper = u[0];
this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
u = new Array();
u[0] = c;
u[1] = c;
// upper case Basic Latin
if ( c >= 0x0041 && c <= 0x005A) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Basic Latin
if ( c >= 0x0061 && c <= 0x007a ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// upper case Latin-1 Supplement
if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Latin-1 Supplement
if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( c == 0x00FF ) {
u[0] = 0x0178;
u[1] = c;
return u;
}
// Latin Extended A
if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
// special case for capital I
if ( c == 0x0130 ) {
u[0] = c;
u[1] = 0x0069;
return u;
}
if ( c == 0x0131 ) {
u[0] = 0x0049;
u[1] = c;
return u;
}
if ( c % 2 == 0 ) {
// if it's even, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's odd, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x0178 ) {
u[0] = c;
u[1] = 0x00FF;
return u;
}
if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
if ( c % 2 == 1 ) {
// if it's odd, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's even, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x017F ) {
u[0] = 0x0053;
u[1] = c;
}
// Latin Extended B
// need to improve this set
if ( c >= 0x0200 && c <= 0x0217 ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c+1;
} else {
u[0] = c-1;
u[1] = c;
}
return u;
}
// Latin Extended Additional
// Range: U+1E00 to U+1EFF
// http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
// Spacing Modifier Leters
// Range: U+02B0 to U+02FF
// Combining Diacritical Marks
// Range: U+0300 to U+036F
// skip Greek for now
// Greek
// Range: U+0370 to U+03FF
// Cyrillic
// Range: U+0400 to U+04FF
if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
u[0] = c;
u[1] = c + 80;
return u;
}
if ( c >= 0x0410 && c <= 0x042F ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0x0430 && c<= 0x044F ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
u[0] = c -80;
u[1] = c;
return u;
}
if ( c >= 0x0460 && c <= 0x047F ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c +1;
} else {
u[0] = c - 1;
u[1] = c;
}
return u;
}
// Armenian
// Range: U+0530 to U+058F
if ( c >= 0x0531 && c <= 0x0556 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x0561 && c < 0x0587 ) {
u[0] = c - 48;
u[1] = c;
return u;
}
// Hebrew
// Range: U+0590 to U+05FF
// Arabic
// Range: U+0600 to U+06FF
// Devanagari
// Range: U+0900 to U+097F
// Bengali
// Range: U+0980 to U+09FF
// Gurmukhi
// Range: U+0A00 to U+0A7F
// Gujarati
// Range: U+0A80 to U+0AFF
// Oriya
// Range: U+0B00 to U+0B7F
// no capital / lower case
// Tamil
// Range: U+0B80 to U+0BFF
// no capital / lower case
// Telugu
// Range: U+0C00 to U+0C7F
// no capital / lower case
// Kannada
// Range: U+0C80 to U+0CFF
// no capital / lower case
// Malayalam
// Range: U+0D00 to U+0D7F
// Thai
// Range: U+0E00 to U+0E7F
// Lao
// Range: U+0E80 to U+0EFF
// Tibetan
// Range: U+0F00 to U+0FBF
// Georgian
// Range: U+10A0 to U+10F0
if ( c >= 0x10A0 && c <= 0x10C5 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
return u;
}
// Hangul Jamo
// Range: U+1100 to U+11FF
// Greek Extended
// Range: U+1F00 to U+1FFF
// skip for now
// General Punctuation
// Range: U+2000 to U+206F
// Superscripts and Subscripts
// Range: U+2070 to U+209F
// Currency Symbols
// Range: U+20A0 to U+20CF
// Combining Diacritical Marks for Symbols
// Range: U+20D0 to U+20FF
// skip for now
// Number Forms
// Range: U+2150 to U+218F
// skip for now
// Arrows
// Range: U+2190 to U+21FF
// Mathematical Operators
// Range: U+2200 to U+22FF
// Miscellaneous Technical
// Range: U+2300 to U+23FF
// Control Pictures
// Range: U+2400 to U+243F
// Optical Character Recognition
// Range: U+2440 to U+245F
// Enclosed Alphanumerics
// Range: U+2460 to U+24FF
// Box Drawing
// Range: U+2500 to U+257F
// Block Elements
// Range: U+2580 to U+259F
// Geometric Shapes
// Range: U+25A0 to U+25FF
// Miscellaneous Symbols
// Range: U+2600 to U+26FF
// Dingbats
// Range: U+2700 to U+27BF
// CJK Symbols and Punctuation
// Range: U+3000 to U+303F
// Hiragana
// Range: U+3040 to U+309F
// Katakana
// Range: U+30A0 to U+30FF
// Bopomofo
// Range: U+3100 to U+312F
// Hangul Compatibility Jamo
// Range: U+3130 to U+318F
// Kanbun
// Range: U+3190 to U+319F
// Enclosed CJK Letters and Months
// Range: U+3200 to U+32FF
// CJK Compatibility
// Range: U+3300 to U+33FF
// Hangul Syllables
// Range: U+AC00 to U+D7A3
// High Surrogates
// Range: U+D800 to U+DB7F
// Private Use High Surrogates
// Range: U+DB80 to U+DBFF
// Low Surrogates
// Range: U+DC00 to U+DFFF
// Private Use Area
// Range: U+E000 to U+F8FF
// CJK Compatibility Ideographs
// Range: U+F900 to U+FAFF
// Alphabetic Presentation Forms
// Range: U+FB00 to U+FB4F
// Arabic Presentation Forms-A
// Range: U+FB50 to U+FDFF
// Combining Half Marks
// Range: U+FE20 to U+FE2F
// CJK Compatibility Forms
// Range: U+FE30 to U+FE4F
// Small Form Variants
// Range: U+FE50 to U+FE6F
// Arabic Presentation Forms-B
// Range: U+FE70 to U+FEFF
// Halfwidth and Fullwidth Forms
// Range: U+FF00 to U+FFEF
if ( c >= 0xFF21 && c <= 0xFF3A ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0xFF41 && c <= 0xFF5A ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// Specials
// Range: U+FFF0 to U+FFFF
return u;
}
function DecimalToHexString( n ) {
n = Number( n );
var h = "0x";
for ( var i = 3; i >= 0; i-- ) {
if ( n >= Math.pow(16, i) ){
var t = Math.floor( n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) {
h += "A";
}
if ( t == 11 ) {
h += "B";
}
if ( t == 12 ) {
h += "C";
}
if ( t == 13 ) {
h += "D";
}
if ( t == 14 ) {
h += "E";
}
if ( t == 15 ) {
h += "F";
}
} else {
h += String( t );
}
} else {
h += "0";
}
}
return h;
}

Просмотреть файл

@ -1,519 +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 Communicator client code, released
* March 31, 1998.
*
* 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 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 ***** */
/**
File Name: 15.5.4.11-5.js
ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
Description:
Returns a string equal in length to the length of the result of converting
this object to a string. The result is a string value, not a String object.
Every character of the result is equal to the corresponding character of the
string, unless that character has a Unicode 2.0 uppercase equivalent, in which
case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
mapping shall be used, which does not depend on implementation or locale.)
Note that the toLowerCase function is intentionally generic; it does not require
that its this value be a String object. Therefore it can be transferred to other
kinds of objects for use as a method.
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "15.5.4.11-5";
var VERSION = "ECMA_1";
startTest();
var TITLE = "String.prototype.toLowerCase()";
writeHeaderToLog( SECTION + " "+ TITLE);
new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
// Cyrillic (part)
// Range: U+0400 to U+04FF
for ( var i = 0x0400; i <= 0x047F; i++ ) {
var U = new Unicode( i );
/*
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
String.fromCharCode(U.lower),
eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
U.lower,
eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
test();
function MyObject( value ) {
this.value = value;
this.substring = String.prototype.substring;
this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
u = GetUnicodeValues( c );
this.upper = u[0];
this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
u = new Array();
u[0] = c;
u[1] = c;
// upper case Basic Latin
if ( c >= 0x0041 && c <= 0x005A) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Basic Latin
if ( c >= 0x0061 && c <= 0x007a ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// upper case Latin-1 Supplement
if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Latin-1 Supplement
if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( c == 0x00FF ) {
u[0] = 0x0178;
u[1] = c;
return u;
}
// Latin Extended A
if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
// special case for capital I
if ( c == 0x0130 ) {
u[0] = c;
u[1] = 0x0069;
return u;
}
if ( c == 0x0131 ) {
u[0] = 0x0049;
u[1] = c;
return u;
}
if ( c % 2 == 0 ) {
// if it's even, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's odd, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x0178 ) {
u[0] = c;
u[1] = 0x00FF;
return u;
}
if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
if ( c % 2 == 1 ) {
// if it's odd, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's even, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x017F ) {
u[0] = 0x0053;
u[1] = c;
}
// Latin Extended B
// need to improve this set
if ( c >= 0x0200 && c <= 0x0217 ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c+1;
} else {
u[0] = c-1;
u[1] = c;
}
return u;
}
// Latin Extended Additional
// Range: U+1E00 to U+1EFF
// http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
// Spacing Modifier Leters
// Range: U+02B0 to U+02FF
// Combining Diacritical Marks
// Range: U+0300 to U+036F
// skip Greek for now
// Greek
// Range: U+0370 to U+03FF
// Cyrillic
// Range: U+0400 to U+04FF
if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
u[0] = c;
u[1] = c + 80;
return u;
}
if ( c >= 0x0410 && c <= 0x042F ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0x0430 && c<= 0x044F ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
u[0] = c -80;
u[1] = c;
return u;
}
if ( c >= 0x0460 && c <= 0x047F ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c +1;
} else {
u[0] = c - 1;
u[1] = c;
}
return u;
}
// Armenian
// Range: U+0530 to U+058F
if ( c >= 0x0531 && c <= 0x0556 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x0561 && c < 0x0587 ) {
u[0] = c - 48;
u[1] = c;
return u;
}
// Hebrew
// Range: U+0590 to U+05FF
// Arabic
// Range: U+0600 to U+06FF
// Devanagari
// Range: U+0900 to U+097F
// Bengali
// Range: U+0980 to U+09FF
// Gurmukhi
// Range: U+0A00 to U+0A7F
// Gujarati
// Range: U+0A80 to U+0AFF
// Oriya
// Range: U+0B00 to U+0B7F
// no capital / lower case
// Tamil
// Range: U+0B80 to U+0BFF
// no capital / lower case
// Telugu
// Range: U+0C00 to U+0C7F
// no capital / lower case
// Kannada
// Range: U+0C80 to U+0CFF
// no capital / lower case
// Malayalam
// Range: U+0D00 to U+0D7F
// Thai
// Range: U+0E00 to U+0E7F
// Lao
// Range: U+0E80 to U+0EFF
// Tibetan
// Range: U+0F00 to U+0FBF
// Georgian
// Range: U+10A0 to U+10F0
if ( c >= 0x10A0 && c <= 0x10C5 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
return u;
}
// Hangul Jamo
// Range: U+1100 to U+11FF
// Greek Extended
// Range: U+1F00 to U+1FFF
// skip for now
// General Punctuation
// Range: U+2000 to U+206F
// Superscripts and Subscripts
// Range: U+2070 to U+209F
// Currency Symbols
// Range: U+20A0 to U+20CF
// Combining Diacritical Marks for Symbols
// Range: U+20D0 to U+20FF
// skip for now
// Number Forms
// Range: U+2150 to U+218F
// skip for now
// Arrows
// Range: U+2190 to U+21FF
// Mathematical Operators
// Range: U+2200 to U+22FF
// Miscellaneous Technical
// Range: U+2300 to U+23FF
// Control Pictures
// Range: U+2400 to U+243F
// Optical Character Recognition
// Range: U+2440 to U+245F
// Enclosed Alphanumerics
// Range: U+2460 to U+24FF
// Box Drawing
// Range: U+2500 to U+257F
// Block Elements
// Range: U+2580 to U+259F
// Geometric Shapes
// Range: U+25A0 to U+25FF
// Miscellaneous Symbols
// Range: U+2600 to U+26FF
// Dingbats
// Range: U+2700 to U+27BF
// CJK Symbols and Punctuation
// Range: U+3000 to U+303F
// Hiragana
// Range: U+3040 to U+309F
// Katakana
// Range: U+30A0 to U+30FF
// Bopomofo
// Range: U+3100 to U+312F
// Hangul Compatibility Jamo
// Range: U+3130 to U+318F
// Kanbun
// Range: U+3190 to U+319F
// Enclosed CJK Letters and Months
// Range: U+3200 to U+32FF
// CJK Compatibility
// Range: U+3300 to U+33FF
// Hangul Syllables
// Range: U+AC00 to U+D7A3
// High Surrogates
// Range: U+D800 to U+DB7F
// Private Use High Surrogates
// Range: U+DB80 to U+DBFF
// Low Surrogates
// Range: U+DC00 to U+DFFF
// Private Use Area
// Range: U+E000 to U+F8FF
// CJK Compatibility Ideographs
// Range: U+F900 to U+FAFF
// Alphabetic Presentation Forms
// Range: U+FB00 to U+FB4F
// Arabic Presentation Forms-A
// Range: U+FB50 to U+FDFF
// Combining Half Marks
// Range: U+FE20 to U+FE2F
// CJK Compatibility Forms
// Range: U+FE30 to U+FE4F
// Small Form Variants
// Range: U+FE50 to U+FE6F
// Arabic Presentation Forms-B
// Range: U+FE70 to U+FEFF
// Halfwidth and Fullwidth Forms
// Range: U+FF00 to U+FFEF
if ( c >= 0xFF21 && c <= 0xFF3A ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0xFF41 && c <= 0xFF5A ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// Specials
// Range: U+FFF0 to U+FFFF
return u;
}
function DecimalToHexString( n ) {
n = Number( n );
var h = "0x";
for ( var i = 3; i >= 0; i-- ) {
if ( n >= Math.pow(16, i) ){
var t = Math.floor( n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) {
h += "A";
}
if ( t == 11 ) {
h += "B";
}
if ( t == 12 ) {
h += "C";
}
if ( t == 13 ) {
h += "D";
}
if ( t == 14 ) {
h += "E";
}
if ( t == 15 ) {
h += "F";
}
} else {
h += String( t );
}
} else {
h += "0";
}
}
return h;
}

Просмотреть файл

@ -1,519 +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 Communicator client code, released
* March 31, 1998.
*
* 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 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 ***** */
/**
File Name: 15.5.4.12-1.js
ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
Description:
Returns a string equal in length to the length of the result of converting
this object to a string. The result is a string value, not a String object.
Every character of the result is equal to the corresponding character of the
string, unless that character has a Unicode 2.0 uppercase equivalent, in which
case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
mapping shall be used, which does not depend on implementation or locale.)
Note that the toUpperCase function is intentionally generic; it does not require
that its this value be a String object. Therefore it can be transferred to other
kinds of objects for use as a method.
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "15.5.4.12-1";
var VERSION = "ECMA_1";
startTest();
var TITLE = "String.prototype.toUpperCase()";
writeHeaderToLog( SECTION + " "+ TITLE);
new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length );
new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length );
new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") );
// Basic Latin, Latin-1 Supplement, Latin Extended A
for ( var i = 0; i <= 0x017f; i++ ) {
var U = new Unicode( i );
// XXX DF fails in java
if ( i == 0x00DF ) {
continue;
}
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
U.upper,
eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
}
test();
function MyObject( value ) {
this.value = value;
this.substring = String.prototype.substring;
this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
u = GetUnicodeValues( c );
this.upper = u[0];
this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
u = new Array();
u[0] = c;
u[1] = c;
// upper case Basic Latin
if ( c >= 0x0041 && c <= 0x005A) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Basic Latin
if ( c >= 0x0061 && c <= 0x007a ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// upper case Latin-1 Supplement
if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Latin-1 Supplement
if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( c == 0x00FF ) {
u[0] = 0x0178;
u[1] = c;
return u;
}
// Latin Extended A
if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
// special case for capital I
if ( c == 0x0130 ) {
u[0] = c;
u[1] = 0x0069;
return u;
}
if ( c == 0x0131 ) {
u[0] = 0x0049;
u[1] = c;
return u;
}
if ( c % 2 == 0 ) {
// if it's even, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's odd, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x0178 ) {
u[0] = c;
u[1] = 0x00FF;
return u;
}
if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
if ( c % 2 == 1 ) {
// if it's odd, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's even, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x017F ) {
u[0] = 0x0053;
u[1] = c;
}
// Latin Extended B
// need to improve this set
if ( c >= 0x0200 && c <= 0x0217 ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c+1;
} else {
u[0] = c-1;
u[1] = c;
}
return u;
}
// Latin Extended Additional
// Range: U+1E00 to U+1EFF
// http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
// Spacing Modifier Leters
// Range: U+02B0 to U+02FF
// Combining Diacritical Marks
// Range: U+0300 to U+036F
// skip Greek for now
// Greek
// Range: U+0370 to U+03FF
// Cyrillic
// Range: U+0400 to U+04FF
if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
u[0] = c;
u[1] = c + 80;
return u;
}
if ( c >= 0x0410 && c <= 0x042F ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0x0430 && c<= 0x044F ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
u[0] = c -80;
u[1] = c;
return u;
}
if ( c >= 0x0460 && c <= 0x047F ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c +1;
} else {
u[0] = c - 1;
u[1] = c;
}
return u;
}
// Armenian
// Range: U+0530 to U+058F
if ( c >= 0x0531 && c <= 0x0556 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x0561 && c < 0x0587 ) {
u[0] = c - 48;
u[1] = c;
return u;
}
// Hebrew
// Range: U+0590 to U+05FF
// Arabic
// Range: U+0600 to U+06FF
// Devanagari
// Range: U+0900 to U+097F
// Bengali
// Range: U+0980 to U+09FF
// Gurmukhi
// Range: U+0A00 to U+0A7F
// Gujarati
// Range: U+0A80 to U+0AFF
// Oriya
// Range: U+0B00 to U+0B7F
// no capital / lower case
// Tamil
// Range: U+0B80 to U+0BFF
// no capital / lower case
// Telugu
// Range: U+0C00 to U+0C7F
// no capital / lower case
// Kannada
// Range: U+0C80 to U+0CFF
// no capital / lower case
// Malayalam
// Range: U+0D00 to U+0D7F
// Thai
// Range: U+0E00 to U+0E7F
// Lao
// Range: U+0E80 to U+0EFF
// Tibetan
// Range: U+0F00 to U+0FBF
// Georgian
// Range: U+10A0 to U+10F0
if ( c >= 0x10A0 && c <= 0x10C5 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
return u;
}
// Hangul Jamo
// Range: U+1100 to U+11FF
// Greek Extended
// Range: U+1F00 to U+1FFF
// skip for now
// General Punctuation
// Range: U+2000 to U+206F
// Superscripts and Subscripts
// Range: U+2070 to U+209F
// Currency Symbols
// Range: U+20A0 to U+20CF
// Combining Diacritical Marks for Symbols
// Range: U+20D0 to U+20FF
// skip for now
// Number Forms
// Range: U+2150 to U+218F
// skip for now
// Arrows
// Range: U+2190 to U+21FF
// Mathematical Operators
// Range: U+2200 to U+22FF
// Miscellaneous Technical
// Range: U+2300 to U+23FF
// Control Pictures
// Range: U+2400 to U+243F
// Optical Character Recognition
// Range: U+2440 to U+245F
// Enclosed Alphanumerics
// Range: U+2460 to U+24FF
// Box Drawing
// Range: U+2500 to U+257F
// Block Elements
// Range: U+2580 to U+259F
// Geometric Shapes
// Range: U+25A0 to U+25FF
// Miscellaneous Symbols
// Range: U+2600 to U+26FF
// Dingbats
// Range: U+2700 to U+27BF
// CJK Symbols and Punctuation
// Range: U+3000 to U+303F
// Hiragana
// Range: U+3040 to U+309F
// Katakana
// Range: U+30A0 to U+30FF
// Bopomofo
// Range: U+3100 to U+312F
// Hangul Compatibility Jamo
// Range: U+3130 to U+318F
// Kanbun
// Range: U+3190 to U+319F
// Enclosed CJK Letters and Months
// Range: U+3200 to U+32FF
// CJK Compatibility
// Range: U+3300 to U+33FF
// Hangul Syllables
// Range: U+AC00 to U+D7A3
// High Surrogates
// Range: U+D800 to U+DB7F
// Private Use High Surrogates
// Range: U+DB80 to U+DBFF
// Low Surrogates
// Range: U+DC00 to U+DFFF
// Private Use Area
// Range: U+E000 to U+F8FF
// CJK Compatibility Ideographs
// Range: U+F900 to U+FAFF
// Alphabetic Presentation Forms
// Range: U+FB00 to U+FB4F
// Arabic Presentation Forms-A
// Range: U+FB50 to U+FDFF
// Combining Half Marks
// Range: U+FE20 to U+FE2F
// CJK Compatibility Forms
// Range: U+FE30 to U+FE4F
// Small Form Variants
// Range: U+FE50 to U+FE6F
// Arabic Presentation Forms-B
// Range: U+FE70 to U+FEFF
// Halfwidth and Fullwidth Forms
// Range: U+FF00 to U+FFEF
if ( c >= 0xFF21 && c <= 0xFF3A ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0xFF41 && c <= 0xFF5A ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// Specials
// Range: U+FFF0 to U+FFFF
return u;
}
function DecimalToHexString( n ) {
n = Number( n );
var h = "0x";
for ( var i = 3; i >= 0; i-- ) {
if ( n >= Math.pow(16, i) ){
var t = Math.floor( n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) {
h += "A";
}
if ( t == 11 ) {
h += "B";
}
if ( t == 12 ) {
h += "C";
}
if ( t == 13 ) {
h += "D";
}
if ( t == 14 ) {
h += "E";
}
if ( t == 15 ) {
h += "F";
}
} else {
h += String( t );
}
} else {
h += "0";
}
}
return h;
}

Просмотреть файл

@ -1,514 +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 Communicator client code, released
* March 31, 1998.
*
* 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 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 ***** */
/**
File Name: 15.5.4.12-1.js
ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
Description:
Returns a string equal in length to the length of the result of converting
this object to a string. The result is a string value, not a String object.
Every character of the result is equal to the corresponding character of the
string, unless that character has a Unicode 2.0 uppercase equivalent, in which
case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
mapping shall be used, which does not depend on implementation or locale.)
Note that the toUpperCase function is intentionally generic; it does not require
that its this value be a String object. Therefore it can be transferred to other
kinds of objects for use as a method.
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "15.5.4.12-1";
var VERSION = "ECMA_1";
startTest();
var TITLE = "String.prototype.toUpperCase()";
writeHeaderToLog( SECTION + " "+ TITLE);
// Cyrillic (part)
// Range: U+0400 to U+04FF
for ( var i = 0x0400; i <= 0x047F; i++ ) {
var U =new Unicode( i );
/*
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
U.upper,
eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
*/
new TestCase( SECTION,
"var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
U.upper,
eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
}
test();
function MyObject( value ) {
this.value = value;
this.substring = String.prototype.substring;
this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
u = GetUnicodeValues( c );
this.upper = u[0];
this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
u = new Array();
u[0] = c;
u[1] = c;
// upper case Basic Latin
if ( c >= 0x0041 && c <= 0x005A) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Basic Latin
if ( c >= 0x0061 && c <= 0x007a ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// upper case Latin-1 Supplement
if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
u[0] = c;
u[1] = c + 32;
return u;
}
// lower case Latin-1 Supplement
if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( c == 0x00FF ) {
u[0] = 0x0178;
u[1] = c;
return u;
}
// Latin Extended A
if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
// special case for capital I
if ( c == 0x0130 ) {
u[0] = c;
u[1] = 0x0069;
return u;
}
if ( c == 0x0131 ) {
u[0] = 0x0049;
u[1] = c;
return u;
}
if ( c % 2 == 0 ) {
// if it's even, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's odd, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x0178 ) {
u[0] = c;
u[1] = 0x00FF;
return u;
}
if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
if ( c % 2 == 1 ) {
// if it's odd, it's a capital and the lower case is c +1
u[0] = c;
u[1] = c+1;
} else {
// if it's even, it's a lower case and upper case is c-1
u[0] = c-1;
u[1] = c;
}
return u;
}
if ( c == 0x017F ) {
u[0] = 0x0053;
u[1] = c;
}
// Latin Extended B
// need to improve this set
if ( c >= 0x0200 && c <= 0x0217 ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c+1;
} else {
u[0] = c-1;
u[1] = c;
}
return u;
}
// Latin Extended Additional
// Range: U+1E00 to U+1EFF
// http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
// Spacing Modifier Leters
// Range: U+02B0 to U+02FF
// Combining Diacritical Marks
// Range: U+0300 to U+036F
// skip Greek for now
// Greek
// Range: U+0370 to U+03FF
// Cyrillic
// Range: U+0400 to U+04FF
if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
u[0] = c;
u[1] = c + 80;
return u;
}
if ( c >= 0x0410 && c <= 0x042F ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0x0430 && c<= 0x044F ) {
u[0] = c - 32;
u[1] = c;
return u;
}
if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
u[0] = c -80;
u[1] = c;
return u;
}
if ( c >= 0x0460 && c <= 0x047F ) {
if ( c % 2 == 0 ) {
u[0] = c;
u[1] = c +1;
} else {
u[0] = c - 1;
u[1] = c;
}
return u;
}
// Armenian
// Range: U+0530 to U+058F
if ( c >= 0x0531 && c <= 0x0556 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x0561 && c < 0x0587 ) {
u[0] = c - 48;
u[1] = c;
return u;
}
// Hebrew
// Range: U+0590 to U+05FF
// Arabic
// Range: U+0600 to U+06FF
// Devanagari
// Range: U+0900 to U+097F
// Bengali
// Range: U+0980 to U+09FF
// Gurmukhi
// Range: U+0A00 to U+0A7F
// Gujarati
// Range: U+0A80 to U+0AFF
// Oriya
// Range: U+0B00 to U+0B7F
// no capital / lower case
// Tamil
// Range: U+0B80 to U+0BFF
// no capital / lower case
// Telugu
// Range: U+0C00 to U+0C7F
// no capital / lower case
// Kannada
// Range: U+0C80 to U+0CFF
// no capital / lower case
// Malayalam
// Range: U+0D00 to U+0D7F
// Thai
// Range: U+0E00 to U+0E7F
// Lao
// Range: U+0E80 to U+0EFF
// Tibetan
// Range: U+0F00 to U+0FBF
// Georgian
// Range: U+10A0 to U+10F0
if ( c >= 0x10A0 && c <= 0x10C5 ) {
u[0] = c;
u[1] = c + 48;
return u;
}
if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
return u;
}
// Hangul Jamo
// Range: U+1100 to U+11FF
// Greek Extended
// Range: U+1F00 to U+1FFF
// skip for now
// General Punctuation
// Range: U+2000 to U+206F
// Superscripts and Subscripts
// Range: U+2070 to U+209F
// Currency Symbols
// Range: U+20A0 to U+20CF
// Combining Diacritical Marks for Symbols
// Range: U+20D0 to U+20FF
// skip for now
// Number Forms
// Range: U+2150 to U+218F
// skip for now
// Arrows
// Range: U+2190 to U+21FF
// Mathematical Operators
// Range: U+2200 to U+22FF
// Miscellaneous Technical
// Range: U+2300 to U+23FF
// Control Pictures
// Range: U+2400 to U+243F
// Optical Character Recognition
// Range: U+2440 to U+245F
// Enclosed Alphanumerics
// Range: U+2460 to U+24FF
// Box Drawing
// Range: U+2500 to U+257F
// Block Elements
// Range: U+2580 to U+259F
// Geometric Shapes
// Range: U+25A0 to U+25FF
// Miscellaneous Symbols
// Range: U+2600 to U+26FF
// Dingbats
// Range: U+2700 to U+27BF
// CJK Symbols and Punctuation
// Range: U+3000 to U+303F
// Hiragana
// Range: U+3040 to U+309F
// Katakana
// Range: U+30A0 to U+30FF
// Bopomofo
// Range: U+3100 to U+312F
// Hangul Compatibility Jamo
// Range: U+3130 to U+318F
// Kanbun
// Range: U+3190 to U+319F
// Enclosed CJK Letters and Months
// Range: U+3200 to U+32FF
// CJK Compatibility
// Range: U+3300 to U+33FF
// Hangul Syllables
// Range: U+AC00 to U+D7A3
// High Surrogates
// Range: U+D800 to U+DB7F
// Private Use High Surrogates
// Range: U+DB80 to U+DBFF
// Low Surrogates
// Range: U+DC00 to U+DFFF
// Private Use Area
// Range: U+E000 to U+F8FF
// CJK Compatibility Ideographs
// Range: U+F900 to U+FAFF
// Alphabetic Presentation Forms
// Range: U+FB00 to U+FB4F
// Arabic Presentation Forms-A
// Range: U+FB50 to U+FDFF
// Combining Half Marks
// Range: U+FE20 to U+FE2F
// CJK Compatibility Forms
// Range: U+FE30 to U+FE4F
// Small Form Variants
// Range: U+FE50 to U+FE6F
// Arabic Presentation Forms-B
// Range: U+FE70 to U+FEFF
// Halfwidth and Fullwidth Forms
// Range: U+FF00 to U+FFEF
if ( c >= 0xFF21 && c <= 0xFF3A ) {
u[0] = c;
u[1] = c + 32;
return u;
}
if ( c >= 0xFF41 && c <= 0xFF5A ) {
u[0] = c - 32;
u[1] = c;
return u;
}
// Specials
// Range: U+FFF0 to U+FFFF
return u;
}
function DecimalToHexString( n ) {
n = Number( n );
var h = "0x";
for ( var i = 3; i >= 0; i-- ) {
if ( n >= Math.pow(16, i) ){
var t = Math.floor( n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) {
h += "A";
}
if ( t == 11 ) {
h += "B";
}
if ( t == 12 ) {
h += "C";
}
if ( t == 13 ) {
h += "D";
}
if ( t == 14 ) {
h += "E";
}
if ( t == 15 ) {
h += "F";
}
} else {
h += String( t );
}
} else {
h += "0";
}
}
return h;
}

Просмотреть файл

@ -12,15 +12,11 @@ script 15.5.3.js
script 15.5.4.1.js
script 15.5.4.10-1.js
script 15.5.4.11-1.js
script 15.5.4.11-2.js
script 15.5.4.11-3.js
script 15.5.4.11-4.js
script 15.5.4.11-5.js
script 15.5.4.11-6.js
script 15.5.4.12-1.js
script 15.5.4.12-2.js
script 15.5.4.12-3.js
script 15.5.4.12-4.js
script 15.5.4.12-5.js
script 15.5.4.2-1.js
script 15.5.4.2-2-n.js

Просмотреть файл

@ -54,9 +54,7 @@ function test()
expect = 'SyntaxError: illegal character';
var formatcontrolchars = ['\u200C',
'\u200D',
'\u200E',
var formatcontrolchars = ['\u200E',
'\u0600',
'\u0601',
'\u0602',

Просмотреть файл

@ -7,3 +7,5 @@ script split-01.js
script split-undefined-separator.js
script split-xregexp.js
script string-object-length.js
script string-space-trim.js
script string-upper-lower-mapping.js

Просмотреть файл

@ -0,0 +1,15 @@
/* Generated by make_unicode.py DO NOT MODIFY */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
var onlySpace = String.fromCharCode(0x9, 0xa, 0xb, 0xc, 0xd, 0x20, 0xa0, 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000, 0xfeff);
assertEq(onlySpace.trim(), "");
assertEq((onlySpace + 'aaaa').trim(), 'aaaa');
assertEq(('aaaa' + onlySpace).trim(), 'aaaa');
assertEq((onlySpace + 'aaaa' + onlySpace).trim(), 'aaaa');
if (typeof reportCompare === "function")
reportCompare(true, true);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,7 +24,7 @@ function test()
try
{
eval("var a\\u0346 = 3;");
eval("var a\\0021 = 3;");
}
catch(ex)
{

Просмотреть файл

@ -62,6 +62,7 @@ struct VMFrame;
namespace mjit {
namespace ic {
struct PICInfo;
struct GetElementIC;
/* Aargh, Windows. */
#ifdef GetProp
@ -181,6 +182,7 @@ class ArgumentsObject : public ::JSObject
#endif
#ifdef JS_POLYIC
friend class ::GetPropCompiler;
friend class mjit::ic::GetElementIC;
#endif
void setInitialLength(uint32 length);

Просмотреть файл

@ -1037,6 +1037,10 @@ class StackFrame
return offsetof(StackFrame, exec);
}
static size_t offsetOfArgs() {
return offsetof(StackFrame, args);
}
void *addressOfArgs() {
return &args;
}

894
js/src/vm/Unicode.cpp Normal file
Просмотреть файл

@ -0,0 +1,894 @@
/* Generated by make_unicode.py DO NOT MODIFY */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
#include "Unicode.h"
namespace js {
namespace unicode {
/*
* So how does indexing work?
* First let's have a look at a jschar, 16-bits:
* [................]
* Step 1:
* Extracting the upper 10 bits from the jschar.
* upper = char >> 6 ([**********......])
* Step 2:
* Using these bits to get an reduced index from index1.
* index = index1[upper]
* Step 3:
* Combining the index and the bottom 6 bits of the orginial jschar.
* real_index = index2[(index << 6) + (jschar & 0x3f)] ([..********++++++])
*
* The advantage here is that the bigest number in index1 doesn't need 10 bits,
* but 8 and we save some memory.
*
* Step 4:
* Get the character informations by looking up real_index in js_charinfo.
*
* Pseudocode of generation:
*
* let table be the mapping of jschar => js_charinfo_index
* let index1 be an empty array
* let index2 be an empty array
* let cache be a hash map
*
* while shift is less then maximal amount you can shift 0xffff before it's 0
* let chunks be table split in chunks of size 2**shift
*
* for every chunk in chunks
* if chunk is in cache
* let index be cache[chunk]
* else
* let index be the max key of index2 + 1
* for element in chunk
* push element to index2
* put index as chunk in cache
*
* push index >> shift to index1
*
* increase shift
* stop if you found the best shift
*/
const CharacterInfo js_charinfo[] = {
{0, 0, 0},
{0, 0, 1},
{0, 0, 4},
{0, 32, 2},
{65504, 0, 2},
{0, 0, 2},
{743, 0, 2},
{121, 0, 2},
{0, 1, 2},
{65535, 0, 2},
{0, 65337, 2},
{65304, 0, 2},
{0, 65415, 2},
{65236, 0, 2},
{195, 0, 2},
{0, 210, 2},
{0, 206, 2},
{0, 205, 2},
{0, 79, 2},
{0, 202, 2},
{0, 203, 2},
{0, 207, 2},
{97, 0, 2},
{0, 211, 2},
{0, 209, 2},
{163, 0, 2},
{0, 213, 2},
{130, 0, 2},
{0, 214, 2},
{0, 218, 2},
{0, 217, 2},
{0, 219, 2},
{56, 0, 2},
{0, 2, 2},
{65535, 1, 2},
{65534, 0, 2},
{65457, 0, 2},
{0, 65439, 2},
{0, 65480, 2},
{0, 65406, 2},
{0, 10795, 2},
{0, 65373, 2},
{0, 10792, 2},
{10815, 0, 2},
{0, 65341, 2},
{0, 69, 2},
{0, 71, 2},
{10783, 0, 2},
{10780, 0, 2},
{10782, 0, 2},
{65326, 0, 2},
{65330, 0, 2},
{65331, 0, 2},
{65334, 0, 2},
{65333, 0, 2},
{65329, 0, 2},
{42893, 613, 10},
{65327, 0, 2},
{65325, 0, 2},
{10743, 0, 2},
{10749, 0, 2},
{65323, 0, 2},
{65322, 0, 2},
{10727, 0, 2},
{65318, 0, 2},
{65467, 0, 2},
{65319, 0, 2},
{65465, 0, 2},
{65317, 0, 2},
{84, 0, 4},
{0, 38, 2},
{0, 37, 2},
{0, 64, 2},
{0, 63, 2},
{65498, 0, 2},
{65499, 0, 2},
{65505, 0, 2},
{65472, 0, 2},
{65473, 0, 2},
{0, 8, 2},
{65474, 0, 2},
{65479, 0, 2},
{65489, 0, 2},
{65482, 0, 2},
{65528, 0, 2},
{65450, 0, 2},
{65456, 0, 2},
{7, 0, 2},
{0, 65476, 2},
{65440, 0, 2},
{0, 65529, 2},
{0, 80, 2},
{0, 0, 16},
{0, 15, 2},
{65521, 0, 2},
{0, 48, 2},
{65488, 0, 2},
{0, 0, 36},
{0, 7264, 2},
{42877, 7545, 10},
{3814, 0, 2},
{65477, 0, 2},
{0, 57921, 2},
{8, 0, 2},
{0, 65528, 2},
{74, 0, 2},
{86, 0, 2},
{100, 0, 2},
{128, 0, 2},
{112, 0, 2},
{126, 0, 2},
{9, 0, 2},
{0, 65462, 2},
{0, 65527, 2},
{58331, 0, 2},
{0, 65450, 2},
{0, 65436, 2},
{0, 65424, 2},
{0, 65408, 2},
{0, 65410, 2},
{0, 58019, 2},
{0, 57153, 2},
{0, 57274, 2},
{0, 28, 2},
{65508, 0, 2},
{0, 16, 2},
{65520, 0, 2},
{0, 26, 0},
{65510, 0, 0},
{0, 54793, 2},
{0, 61722, 2},
{0, 54809, 2},
{54741, 0, 2},
{54744, 0, 2},
{0, 54756, 2},
{0, 54787, 2},
{0, 54753, 2},
{0, 54754, 2},
{0, 54721, 2},
{58272, 0, 2},
};
const uint16 index1[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 26, 26, 26, 26,
26, 67, 68, 69, 70, 71, 72, 73, 74, 26, 26, 26, 26, 26, 26, 26, 26, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 34,
93, 94, 95, 96, 97, 98, 34, 99, 26, 100, 26, 101, 102, 102, 103, 102, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 115, 116, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 117, 118, 102, 119,
120, 121, 122, 123, 124, 34, 34, 34, 34, 34, 34, 34, 125, 74, 126, 127, 128, 26,
129, 130, 34, 34, 34, 34, 34, 34, 34, 34, 131, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 132, 34, 131, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 133, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 134, 135, 26, 26, 26, 26, 136, 137,
138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
156, 34, 34, 157, 131, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 158, 159,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 34, 26, 26, 26, 26, 160, 160, 26, 161, 162, 163, 164, 165,
26, 26, 26, 26, 166, 167, 168, 169, 170, 171, 26, 172, 173, 174, 175, 176,
};
const uint16 index2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 0, 0, 0, 0, 2, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 6, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3,
3, 3, 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, 0, 0, 103, 103, 103, 103, 103, 103, 103, 103,
104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104,
104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 0, 0, 104, 104, 104, 104,
104, 104, 0, 0, 5, 103, 5, 103, 5, 103, 5, 103, 0, 104, 0, 104, 0, 104,
0, 104, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104,
105, 105, 106, 106, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 0, 0, 103, 103,
103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103,
103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103,
103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 5, 111, 5, 0, 5, 5,
104, 104, 112, 112, 113, 0, 114, 0, 0, 0, 5, 111, 5, 0, 5, 5, 115, 115,
115, 115, 113, 0, 0, 0, 103, 103, 5, 5, 0, 0, 5, 5, 104, 104, 116, 116,
0, 0, 0, 0, 103, 103, 5, 5, 5, 87, 5, 5, 104, 104, 117, 117, 90, 0,
0, 0, 0, 0, 5, 111, 5, 0, 5, 5, 118, 118, 119, 119, 113, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 5, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 0, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 0, 8, 9, 129, 130, 131, 132, 133, 8, 9, 8, 9, 8,
9, 134, 135, 136, 137, 5, 8, 9, 5, 8, 9, 5, 5, 5, 5, 5, 5, 5,
138, 138, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,
8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,
8, 9, 5, 0, 0, 0, 0, 0, 0, 8, 9, 8, 9, 2, 2, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139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 3,
3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 2, 0, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5,
5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5,
5, 5, 0, 0, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
};
} /* namespace unicode */
} /* namespace js */

320
js/src/vm/Unicode.h Normal file
Просмотреть файл

@ -0,0 +1,320 @@
/*
* ***** 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 SpiderMonkey JavaScript engine.
*
* The Initial Developer of the Original Code is
* SpiderMonkey Unicode support code.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tom Schuster <evilpies@gmail.com>
*
* 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 Unicode_h__
#define Unicode_h__
#include "jsstr.h"
#ifdef DEBUG
#include <stdio.h> /* For EOF */
#endif
extern const bool js_isidstart[];
extern const bool js_isident[];
extern const bool js_isspace[];
namespace js {
namespace unicode {
/*
* This enum contains the all the knowledge required to handle
* Unicode in JavaScript.
*
* SPACE
* Every character that is either in the ECMA-262 5th Edition
* class WhiteSpace or LineTerminator.
*
* WhiteSpace
* \u0009, \u000B, \u000C, \u0020, \u00A0 and \uFEFF
* and every other Unicode character with the General Category "Zs".
* In pratice this is every character with the value "Zs" as the third
* field (after the char code in hex, and the name) called General_Category
* (see http://www.unicode.org/reports/tr44/#UnicodeData.txt)
* in the file UnicodeData.txt.
*
* LineTerminator
* \u000A, \u000D, \u2028, \u2029
*
* LETTER
* This are all characters included UnicodeLetter from ECMA-262.
* This includes the category 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl'
*
* IDENTIFIER_PART
* This is UnicodeCombiningMark, UnicodeDigit, UnicodeConnectorPunctuation.
* Aka categories Mn/Mc, Md, Nd, Pc
* And <ZWNJ> and <ZWJ>.
* Attention: FLAG_LETTER is _not_ IdentifierStart, but you could build
* a matcher for the real IdentifierPart like this:
*
* if isEscapeSequence():
* handleEscapeSequence()
* return True
* if char in ['$', '_']:
* return True
* if GetFlag(char) & (FLAG_IDENTIFIER_PART | FLAG_LETTER):
* return True
*
* NO_DELTA
* See comment in CharacterInfo
*
* ENCLOSING_MARK / COMBINING_SPACING_MARK
* Something for E4X....
*/
struct CharFlag {
enum temp {
SPACE = 1 << 0,
LETTER = 1 << 1,
IDENTIFIER_PART = 1 << 2,
NO_DELTA = 1 << 3,
ENCLOSING_MARK = 1 << 4,
COMBINING_SPACING_MARK = 1 << 5
};
};
const jschar BYTE_ORDER_MARK2 = 0xFFFE;
const jschar NO_BREAK_SPACE = 0x00A0;
class CharacterInfo {
/*
* upperCase and loweCase normally store the delta between two
* letters. For example the lower case alpha (a) has the char code
* 97, and the upper case alpha (A) has 65. So for "a" we would
* store -32 in upperCase (97 + (-32) = 65) and 0 in lowerCase,
* because this char is already in lower case.
* Well, not -32 exactly, but (2**16 - 32) to induce
* unsigned overflow with identical mathematical behavior.
* For upper case alpha, we would store 0 in upperCase and 32 in
* lowerCase (65 + 32 = 97).
*
* If the delta between the chars wouldn't fit in a T, the flag
* FLAG_NO_DELTA is set, and you can just use upperCase and lowerCase
* without adding them the base char. See CharInfo.toUpperCase().
*
* We use deltas to reuse information for multiple characters. For
* example the whole lower case latin alphabet fits into one entry,
* because it's always a UnicodeLetter and upperCase contains
* -32.
*/
public:
uint16 upperCase;
uint16 lowerCase;
uint8 flags;
inline bool isSpace() const {
return flags & CharFlag::SPACE;
}
inline bool isLetter() const {
return flags & CharFlag::LETTER;
}
inline bool isIdentifierPart() const {
return flags & (CharFlag::IDENTIFIER_PART | CharFlag::LETTER);
}
inline bool isEnclosingMark() const {
return flags & CharFlag::ENCLOSING_MARK;
}
inline bool isCombiningSpacingMark() const {
return flags & CharFlag::COMBINING_SPACING_MARK;
}
};
extern const uint16 index1[];
extern const uint16 index2[];
extern const CharacterInfo js_charinfo[];
inline const CharacterInfo&
CharInfo(jschar code)
{
uint16 index = index1[code >> 6];
index = index2[(index << 6) + (code & 0x3f)];
return js_charinfo[index];
}
inline bool
IsIdentifierStart(jschar ch)
{
/*
* ES5 7.6 IdentifierStart
* $ (dollar sign)
* _ (underscore)
* or any UnicodeLetter.
*
* We use a lookup table for small and thus common characters for speed.
*/
if (ch < 128)
return js_isidstart[ch];
return CharInfo(ch).isLetter();
}
inline bool
IsIdentifierPart(jschar ch)
{
/* Matches ES5 7.6 IdentifierPart. */
if (ch < 128)
return js_isident[ch];
return CharInfo(ch).isIdentifierPart();
}
inline bool
IsLetter(jschar ch)
{
return CharInfo(ch).isLetter();
}
inline bool
IsSpace(jschar ch)
{
/*
* IsSpace checks if some character is included in the merged set
* of WhiteSpace and LineTerminator, specified by ES5 7.2 and 7.3.
* We combined them, because in practice nearly every
* calling function wants this, except some code in the tokenizer.
*
* We use a lookup table for ASCII-7 characters, because they are
* very common and must be handled quickly in the tokenizer.
* NO-BREAK SPACE is supposed to be the most common character not in
* this range, so we inline this case, too.
*/
if (ch < 128)
return js_isspace[ch];
if (ch == NO_BREAK_SPACE)
return true;
return CharInfo(ch).isSpace();
}
inline bool
IsSpaceOrBOM2(jschar ch)
{
if (ch < 128)
return js_isspace[ch];
/* We accept BOM2 (0xFFFE) for compatibility reasons in the parser. */
if (ch == NO_BREAK_SPACE || ch == BYTE_ORDER_MARK2)
return true;
return CharInfo(ch).isSpace();
}
inline jschar
ToUpperCase(jschar ch)
{
const CharacterInfo &info = CharInfo(ch);
/*
* The delta didn't fit into T, so we had to store the
* actual char code.
*/
if (info.flags & CharFlag::NO_DELTA)
return info.upperCase;
return uint16(ch) + info.upperCase;
}
inline jschar
ToLowerCase(jschar ch)
{
const CharacterInfo &info = CharInfo(ch);
if (info.flags & CharFlag::NO_DELTA)
return info.lowerCase;
return uint16(ch) + info.lowerCase;
}
/* XML support functions */
inline bool
IsXMLSpace(jschar ch)
{
return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
}
inline bool
IsXMLNamespaceStart(jschar ch)
{
if (ch == '_')
return true;
return CharInfo(ch).isCombiningSpacingMark() || IsIdentifierStart(ch);
}
inline bool
IsXMLNamespacePart(jschar ch)
{
if (ch == '.' || ch == '-' || ch == '_')
return true;
return CharInfo(ch).isEnclosingMark() || IsIdentifierPart(ch);
}
inline bool
IsXMLNameStart(jschar ch)
{
if (ch == '_' || ch == ':')
return true;
return CharInfo(ch).isCombiningSpacingMark() || IsIdentifierStart(ch);
}
inline bool
IsXMLNamePart(jschar ch)
{
if (ch == '.' || ch == '-' || ch == '_' || ch == ':')
return true;
return CharInfo(ch).isEnclosingMark() || IsIdentifierPart(ch);
}
} /* namespace unicode */
} /* namespace js */
#endif /* Unicode_h__ */

Просмотреть файл

@ -63,10 +63,12 @@ namespace JSC { namespace Yarr {
typedef jschar UChar;
typedef JSLinearString UString;
using namespace js::unicode;
class Unicode {
public:
static UChar toUpper(UChar c) { return JS_TOUPPER(c); }
static UChar toLower(UChar c) { return JS_TOLOWER(c); }
static UChar toUpper(UChar c) { return ToUpperCase(c); }
static UChar toLower(UChar c) { return ToLowerCase(c); }
};
/*

Просмотреть файл

@ -107,7 +107,7 @@ public:
PRBool IsRunning();
nsCOMPtr<nsITimer> mRepeatTimer;
PRBool mDelta;
PRInt32 mDelta;
nsListBoxBodyFrame* mOuter;
};

Просмотреть файл

@ -114,6 +114,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
mPopupState(ePopupClosed),
mPopupAlignment(POPUPALIGNMENT_NONE),
mPopupAnchor(POPUPALIGNMENT_NONE),
mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT),
mFlipBoth(PR_FALSE),
mIsOpenChanged(PR_FALSE),
mIsContextMenu(PR_FALSE),
@ -121,7 +122,6 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
mGeneratedChildren(PR_FALSE),
mMenuCanOverlapOSBar(PR_FALSE),
mShouldAutoPosition(PR_TRUE),
mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT),
mInContentShell(PR_TRUE),
mIsMenuLocked(PR_FALSE),
mHFlip(PR_FALSE),

Просмотреть файл

@ -435,6 +435,8 @@ protected:
// popup alignment relative to the anchor node
PRInt8 mPopupAlignment;
PRInt8 mPopupAnchor;
// One of nsIPopupBoxObject::ROLLUP_DEFAULT/ROLLUP_CONSUME/ROLLUP_NO_CONSUME
PRInt8 mConsumeRollupEvent;
PRPackedBool mFlipBoth; // flip in both directions
PRPackedBool mIsOpenChanged; // true if the open state changed since the last layout
@ -445,7 +447,6 @@ protected:
PRPackedBool mMenuCanOverlapOSBar; // can we appear over the taskbar/menubar?
PRPackedBool mShouldAutoPosition; // Should SetPopupPosition be allowed to auto position popup?
PRPackedBool mConsumeRollupEvent; // Should the rollup event be consumed?
PRPackedBool mInContentShell; // True if the popup is in a content shell
PRPackedBool mIsMenuLocked; // Should events inside this menu be ignored?

Просмотреть файл

@ -710,7 +710,7 @@ protected:
nsresult NotifyOnStateChange(PRUint16 aOldState);
nsCOMPtr<mozIStoragePendingStatement> mAsyncPendingStmt;
PRBool mAsyncCanceledState;
AsyncCanceledState mAsyncCanceledState;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryContainerResultNode,

Просмотреть файл

@ -66,6 +66,21 @@ HISTOGRAM(EARLY_GLUESTARTUP_HARD_FAULTS, 1, 100, 12, LINEAR, "Hard faults count
HISTOGRAM(GLUESTARTUP_HARD_FAULTS, 1, 500, 12, EXPONENTIAL, "Hard faults count after glue startup")
HISTOGRAM(PAGE_FAULTS_HARD, 8, 64 * 1024, 13, EXPONENTIAL, "Hard page faults (since last telemetry ping)")
#endif
HISTOGRAM(FONTLIST_INITOTHERFAMILYNAMES, 1, 30000, 50, EXPONENTIAL, "Time(ms) spent on reading other family names from all fonts")
HISTOGRAM(FONTLIST_INITFACENAMELISTS, 1, 30000, 50, EXPONENTIAL, "Time(ms) spent on reading family names from all fonts")
#if defined(XP_WIN)
HISTOGRAM(DWRITEFONT_INITFONTLIST_TOTAL, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::InitFontList Total (ms)")
HISTOGRAM(DWRITEFONT_INITFONTLIST_INIT, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::InitFontList init (ms)")
HISTOGRAM(DWRITEFONT_INITFONTLIST_GDI, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::InitFontList GdiInterop object (ms)")
HISTOGRAM(DWRITEFONT_DELAYEDINITFONTLIST_TOTAL, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::DelayedInitFontList Total (ms)")
HISTOGRAM(DWRITEFONT_DELAYEDINITFONTLIST_COUNT, 1, 10000, 10, EXPONENTIAL, "gfxDWriteFontList::DelayedInitFontList Font Family Count")
HISTOGRAM(DWRITEFONT_DELAYEDINITFONTLIST_GDI_TABLE, 0, 1, 2, BOOLEAN, "gfxDWriteFontList::DelayedInitFontList GDI Table Access")
HISTOGRAM(DWRITEFONT_DELAYEDINITFONTLIST_COLLECT, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::DelayedInitFontList GetSystemFontCollection (ms)")
HISTOGRAM(DWRITEFONT_DELAYEDINITFONTLIST_ITERATE, 1, 30000, 10, EXPONENTIAL, "gfxDWriteFontList::DelayedInitFontList iterate over families (ms)")
HISTOGRAM(GDI_INITFONTLIST_TOTAL, 1, 30000, 10, EXPONENTIAL, "gfxGDIFontList::InitFontList Total (ms)")
#elif defined(XP_MACOSX)
HISTOGRAM(MAC_INITFONTLIST_TOTAL, 1, 30000, 10, EXPONENTIAL, "gfxMacPlatformFontList::InitFontList Total (ms)")
#endif
HISTOGRAM(SHUTDOWN_OK, 0, 1, 2, BOOLEAN, "Did the browser start after a successful shutdown")
HISTOGRAM(IMAGE_DECODE_LATENCY, 50, 5000000, 100, EXPONENTIAL, "Time spent decoding an image chunk (us)")

Просмотреть файл

@ -53,6 +53,9 @@ var EXPORTED_SYMBOLS = [ "DownloadUtils" ];
* [string timeLeft, double newLast]
* getTimeLeft(double aSeconds, [optional] double aLastSec)
*
* [string dateCompact, string dateComplete]
* getReadableDates(Date aDate, [optional] Date aNow)
*
* [string displayHost, string fullHost]
* getURIHost(string aURIString)
*
@ -93,6 +96,8 @@ let kStrings = {
timeLeftDouble: "timeLeftDouble",
timeFewSeconds: "timeFewSeconds",
timeUnknown: "timeUnknown",
monthDate: "monthDate",
yesterday: "yesterday",
doneScheme: "doneScheme",
doneFileScheme: "doneFileScheme",
units: ["bytes", "kilobyte", "megabyte", "gigabyte"],
@ -320,6 +325,71 @@ let DownloadUtils = {
return [timeLeft, aSeconds];
},
/**
* Converts a Date object to two readable formats, one compact, one complete.
* The compact format is relative to the current date, and is not an accurate
* representation. For example, only the time is displayed for today. The
* complete format always includes both the date and the time, excluding the
* seconds, and is often shown when hovering the cursor over the compact
* representation.
*
* @param aDate
* Date object representing the date and time to format. It is assumed
* that this value represents a past date.
* @param [optional] aNow
* Date object representing the current date and time. The real date
* and time of invocation is used if this parameter is omitted.
* @return A pair: [compact text, complete text]
*/
getReadableDates: function DU_getReadableDates(aDate, aNow)
{
if (!aNow) {
aNow = new Date();
}
let dts = Cc["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Ci.nsIScriptableDateFormat);
// Figure out when today begins
let today = new Date(aNow.getFullYear(), aNow.getMonth(), aNow.getDate());
// Figure out if the time is from today, yesterday, this week, etc.
let dateTimeCompact;
if (aDate >= today) {
// After today started, show the time
dateTimeCompact = dts.FormatTime("",
dts.timeFormatNoSeconds,
aDate.getHours(),
aDate.getMinutes(),
0);
} else if (today - aDate < (24 * 60 * 60 * 1000)) {
// After yesterday started, show yesterday
dateTimeCompact = gStr.yesterday;
} else if (today - aDate < (6 * 24 * 60 * 60 * 1000)) {
// After last week started, show day of week
dateTimeCompact = aDate.toLocaleFormat("%A");
} else {
// Show month/day
let month = aDate.toLocaleFormat("%B");
// Remove leading 0 by converting the date string to a number
let date = Number(aDate.toLocaleFormat("%d"));
dateTimeCompact = replaceInsert(gStr.monthDate, 1, month);
dateTimeCompact = replaceInsert(dateTimeCompact, 2, date);
}
let dateTimeFull = dts.FormatDateTime("",
dts.dateFormatLong,
dts.timeFormatNoSeconds,
aDate.getFullYear(),
aDate.getMonth() + 1,
aDate.getDate(),
aDate.getHours(),
aDate.getMinutes(),
0);
return [dateTimeCompact, dateTimeFull];
},
/**
* Get the appropriate display host string for a URI string depending on if
* the URI has an eTLD + 1, is an IP address, a local file, or other protocol

Просмотреть файл

@ -111,8 +111,6 @@ let gStr = {
stateBlockedParentalControls: "stateBlocked",
stateBlockedPolicy: "stateBlockedPolicy",
stateDirty: "stateDirty",
yesterday: "yesterday",
monthDate: "monthDate",
downloadsTitleFiles: "downloadsTitleFiles",
downloadsTitlePercent: "downloadsTitlePercent",
fileExecutableSecurityWarningTitle: "fileExecutableSecurityWarningTitle",
@ -1052,51 +1050,10 @@ function updateTime(aItem)
if (aItem.inProgress)
return;
let dts = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
// Figure out when today begins
let now = new Date();
let today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
// Get the end time to display
let end = new Date(parseInt(aItem.getAttribute("endTime")));
// Figure out if the end time is from today, yesterday, this week, etc.
let dateTime;
if (end >= today) {
// Download finished after today started, show the time
dateTime = dts.FormatTime("", dts.timeFormatNoSeconds,
end.getHours(), end.getMinutes(), 0);
} else if (today - end < (24 * 60 * 60 * 1000)) {
// Download finished after yesterday started, show yesterday
dateTime = gStr.yesterday;
} else if (today - end < (6 * 24 * 60 * 60 * 1000)) {
// Download finished after last week started, show day of week
dateTime = end.toLocaleFormat("%A");
} else {
// Download must have been from some time ago.. show month/day
let month = end.toLocaleFormat("%B");
// Remove leading 0 by converting the date string to a number
let date = Number(end.toLocaleFormat("%d"));
dateTime = replaceInsert(gStr.monthDate, 1, month);
dateTime = replaceInsert(dateTime, 2, date);
}
aItem.setAttribute("dateTime", dateTime);
// Set the tooltip to be the full date and time
let dateTimeTip = dts.FormatDateTime("",
dts.dateFormatLong,
dts.timeFormatNoSeconds,
end.getFullYear(),
end.getMonth() + 1,
end.getDate(),
end.getHours(),
end.getMinutes(),
0);
aItem.setAttribute("dateTimeTip", dateTimeTip);
let [dateCompact, dateComplete] = DownloadUtils.getReadableDates(end);
aItem.setAttribute("dateTime", dateCompact);
aItem.setAttribute("dateTimeTip", dateComplete);
}
/**

Просмотреть файл

@ -96,6 +96,47 @@ function testURI(aURI, aDisp, aHost)
do_check_eq(host, aHost);
}
function testGetReadableDates(aDate, aCompactValue)
{
const now = new Date(2000, 11, 31, 11, 59, 59);
let [dateCompact] = DownloadUtils.getReadableDates(aDate, now);
do_check_eq(dateCompact, aCompactValue);
}
function testAllGetReadableDates()
{
// This test cannot depend on the current date and time, or the date format.
// It depends on being run with the English localization, however.
const today_11_30 = new Date(2000, 11, 31, 11, 30, 15);
const today_12_30 = new Date(2000, 11, 31, 12, 30, 15);
const yesterday_11_30 = new Date(2000, 11, 30, 11, 30, 15);
const yesterday_12_30 = new Date(2000, 11, 30, 12, 30, 15);
const twodaysago = new Date(2000, 11, 29, 11, 30, 15);
const sixdaysago = new Date(2000, 11, 25, 11, 30, 15);
const sevendaysago = new Date(2000, 11, 24, 11, 30, 15);
let dts = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
getService(Components.interfaces.nsIScriptableDateFormat);
testGetReadableDates(today_11_30, dts.FormatTime("", dts.timeFormatNoSeconds,
11, 30, 0));
testGetReadableDates(today_12_30, dts.FormatTime("", dts.timeFormatNoSeconds,
12, 30, 0));
testGetReadableDates(yesterday_11_30, "Yesterday");
testGetReadableDates(yesterday_12_30, "Yesterday");
testGetReadableDates(twodaysago, twodaysago.toLocaleFormat("%A"));
testGetReadableDates(sixdaysago, sixdaysago.toLocaleFormat("%A"));
testGetReadableDates(sevendaysago, sevendaysago.toLocaleFormat("%B") + " " +
sevendaysago.toLocaleFormat("%d"));
let [, dateTimeFull] = DownloadUtils.getReadableDates(today_11_30);
do_check_eq(dateTimeFull, dts.FormatDateTime("", dts.dateFormatLong,
dts.timeFormatNoSeconds,
2000, 12, 31, 11, 30, 0));
}
function run_test()
{
testConvertByteUnits(-1, "-1", "bytes");
@ -163,4 +204,6 @@ function run_test()
testURI("file:///C:/Cool/Stuff/", "local file", "local file");
testURI("moz-icon:file:///test.extension", "moz-icon resource", "moz-icon resource");
testURI("about:config", "about resource", "about resource");
testAllGetReadableDates();
}

Просмотреть файл

@ -112,6 +112,10 @@ nsMIMEInfoAndroid::GetMimeInfoForFileExt(const nsACString& aFileExt,
mozilla::AndroidBridge::Bridge()->
GetMimeTypeFromExtensions(aFileExt, mimeType);
// "*/*" means that the bridge didn't know.
if (mimeType.Equals(nsDependentCString("*/*"), nsCaseInsensitiveCStringComparator()))
return false;
PRBool found = GetMimeInfoForMimeType(mimeType, aMimeInfo);
(*aMimeInfo)->SetPrimaryExtension(aFileExt);
return found;
@ -384,8 +388,8 @@ nsMIMEInfoAndroid::GetPossibleLocalHandlers(nsIArray * *aPossibleLocalHandlers)
NS_IMETHODIMP
nsMIMEInfoAndroid::LaunchWithFile(nsIFile *aFile)
{
nsIURI* uri;
NS_NewFileURI(&uri, aFile);
nsCOMPtr<nsIURI> uri;
NS_NewFileURI(getter_AddRefs(uri), aFile);
LoadUriInternal(uri);
return NS_OK;
}

Просмотреть файл

@ -910,7 +910,7 @@ NS_IMETHODIMP nsPrintSettings::SetPlexName(const PRUnichar * aPlexName)
NS_IMETHODIMP nsPrintSettings::GetHowToEnableFrameUI(PRInt16 *aHowToEnableFrameUI)
{
NS_ENSURE_ARG_POINTER(aHowToEnableFrameUI);
*aHowToEnableFrameUI = (PRInt32)mHowToEnableFrameUI;
*aHowToEnableFrameUI = mHowToEnableFrameUI;
return NS_OK;
}
NS_IMETHODIMP nsPrintSettings::SetHowToEnableFrameUI(PRInt16 aHowToEnableFrameUI)

Просмотреть файл

@ -98,7 +98,7 @@ protected:
PRInt16 mPrintFrameTypeUsage;
PRInt16 mPrintFrameType;
PRBool mHowToEnableFrameUI;
PRInt16 mHowToEnableFrameUI;
PRBool mIsCancelled;
PRBool mPrintSilent;
PRBool mPrintPreview;