mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Merge last green changeset from mozilla-inbound to mozilla-central
This commit is contained in:
commit
83f600a726
@ -881,7 +881,7 @@ pref("browser.privatebrowsing.dont_prompt_on_enter", false);
|
||||
pref("browser.bookmarks.editDialog.firstEditField", "namePicker");
|
||||
|
||||
// base url for the wifi geolocation network provider
|
||||
pref("geo.wifi.uri", "https://www.google.com/loc/json");
|
||||
pref("geo.wifi.uri", "https://maps.googleapis.com/maps/api/browserlocation/json");
|
||||
pref("geo.wifi.protocol", 0);
|
||||
|
||||
// Whether to use a panel that looks like an OS X sheet for customization
|
||||
|
@ -107,7 +107,6 @@ public class WatcherService extends Service
|
||||
|
||||
|
||||
private IWatcherService.Stub stub = new IWatcherService.Stub() {
|
||||
@Override
|
||||
public int UpdateApplication(String sAppName, String sFileName, String sOutFile, int bReboot) throws RemoteException
|
||||
{
|
||||
return UpdtApp(sAppName, sFileName, sOutFile, bReboot);
|
||||
@ -874,7 +873,6 @@ public class WatcherService extends Service
|
||||
runner.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
bInstalling = true;
|
||||
UpdtApp(msPkgName, msPkgFileName, msOutFile, mbReboot);
|
||||
|
@ -1737,7 +1737,8 @@ nsScriptSecurityManager::CheckFunctionAccess(JSContext *aCx, void *aFunObj,
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, (JSObject *)aFunObj);
|
||||
JS_ASSERT(JS_ObjectIsFunction(aCx, (JSObject *)aFunObj));
|
||||
JSFunction *fun = (JSFunction *)JS_GetPrivate(aCx, (JSObject *)aFunObj);
|
||||
JSScript *script = JS_GetFunctionScript(aCx, fun);
|
||||
|
||||
NS_ASSERTION(!script, "Null principal for non-native function!");
|
||||
@ -2218,7 +2219,7 @@ nsScriptSecurityManager::GetFunctionObjectPrincipal(JSContext *cx,
|
||||
return result;
|
||||
}
|
||||
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSFunction *fun = (JSFunction *)JS_GetPrivate(cx, obj);
|
||||
JSScript *script = JS_GetFunctionScript(cx, fun);
|
||||
|
||||
if (!script)
|
||||
@ -2284,7 +2285,7 @@ nsScriptSecurityManager::GetFramePrincipal(JSContext *cx,
|
||||
#ifdef DEBUG
|
||||
if (NS_SUCCEEDED(*rv) && !result)
|
||||
{
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSFunction *fun = (JSFunction *)JS_GetPrivate(cx, obj);
|
||||
JSScript *script = JS_GetFunctionScript(cx, fun);
|
||||
|
||||
NS_ASSERTION(!script, "Null principal for non-native function!");
|
||||
|
@ -223,7 +223,6 @@ MOZ_XUL = @MOZ_XUL@
|
||||
MOZ_RDF = @MOZ_RDF@
|
||||
|
||||
NECKO_PROTOCOLS = @NECKO_PROTOCOLS@
|
||||
NECKO_DISK_CACHE = @NECKO_DISK_CACHE@
|
||||
NECKO_COOKIES = @NECKO_COOKIES@
|
||||
NECKO_WIFI = @NECKO_WIFI@
|
||||
MOZ_AUTH_EXTENSION = @MOZ_AUTH_EXTENSION@
|
||||
|
78
configure.in
78
configure.in
@ -2107,6 +2107,8 @@ case "$target" in
|
||||
# logging code in nsObjCExceptions.h. Currently we only use that in debug
|
||||
# builds.
|
||||
MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
|
||||
if test "x$lto_is_enabled" = "xyes"; then
|
||||
echo "Skipping -dead_strip because lto is enabled."
|
||||
@ -2253,6 +2255,8 @@ ia64*-hpux*)
|
||||
else
|
||||
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
|
||||
fi
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
;;
|
||||
|
||||
*-*linux*)
|
||||
@ -2278,7 +2282,8 @@ ia64*-hpux*)
|
||||
fi
|
||||
MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
|
||||
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
|
||||
MOZ_DEBUG_FLAGS="-g"
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
fi
|
||||
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
|
||||
@ -2371,7 +2376,8 @@ ia64*-hpux*)
|
||||
CFLAGS="$CFLAGS -we4553"
|
||||
CXXFLAGS="$CXXFLAGS -we4553"
|
||||
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
|
||||
MOZ_DEBUG_FLAGS='-Zi'
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS='-Zi -Oy-'
|
||||
MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
|
||||
WARNINGS_AS_ERRORS='-WX'
|
||||
# If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
|
||||
@ -3588,53 +3594,6 @@ then
|
||||
LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl See if mmap sees writes
|
||||
dnl For cross compiling, just define it as no, which is a safe default
|
||||
dnl ========================================================
|
||||
AC_MSG_CHECKING(whether mmap() sees write()s)
|
||||
|
||||
changequote(,)
|
||||
mmap_test_prog='
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
char fname[] = "conftest.file";
|
||||
char zbuff[1024]; /* Fractional page is probably worst case */
|
||||
|
||||
int main() {
|
||||
char *map;
|
||||
int fd;
|
||||
int i;
|
||||
unlink(fname);
|
||||
fd = open(fname, O_RDWR | O_CREAT, 0660);
|
||||
if(fd<0) return 1;
|
||||
unlink(fname);
|
||||
write(fd, zbuff, sizeof(zbuff));
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
|
||||
if(map==(char*)-1) return 2;
|
||||
for(i=0; fname[i]; i++) {
|
||||
int rc = write(fd, &fname[i], 1);
|
||||
if(map[i]!=fname[i]) return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
'
|
||||
changequote([,])
|
||||
|
||||
AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
|
||||
|
||||
AC_MSG_RESULT("$result")
|
||||
|
||||
if test "$result" = "no"; then
|
||||
AC_DEFINE(MMAP_MISSES_WRITES)
|
||||
fi
|
||||
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl ========================================================
|
||||
@ -4778,7 +4737,6 @@ MOZ_DISABLE_DOMCRYPTO=
|
||||
NSS_DISABLE_DBM=
|
||||
NECKO_WIFI=1
|
||||
NECKO_COOKIES=1
|
||||
NECKO_DISK_CACHE=1
|
||||
NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg"
|
||||
USE_ARM_KUSER=
|
||||
BUILD_CTYPES=1
|
||||
@ -5194,7 +5152,7 @@ incorrect])
|
||||
fi
|
||||
|
||||
MOZ_ENABLE_QTMOBILITY=
|
||||
PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback,
|
||||
PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
|
||||
MOZ_ENABLE_QTMOBILITY=1,
|
||||
MOZ_ENABLE_QTMOBILITY=)
|
||||
if test "$MOZ_ENABLE_QTMOBILITY"; then
|
||||
@ -5202,12 +5160,13 @@ incorrect])
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
|
||||
else
|
||||
AC_CHECK_LIB(QtSensors QtFeedback, main, [
|
||||
AC_CHECK_LIB(QtSensors QtFeedback QtLocation, main, [
|
||||
MOZ_ENABLE_QTMOBILITY=1
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtFeedback"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtLocation"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
|
||||
])
|
||||
fi
|
||||
if test "$MOZ_ENABLE_QTMOBILITY"; then
|
||||
@ -8764,19 +8723,6 @@ for p in $NECKO_PROTOCOLS; do
|
||||
AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
|
||||
done
|
||||
|
||||
dnl
|
||||
dnl option to disable necko's disk cache
|
||||
dnl
|
||||
MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
|
||||
[ --disable-necko-disk-cache
|
||||
Disable necko disk cache],
|
||||
NECKO_DISK_CACHE=,
|
||||
NECKO_DISK_CACHE=1)
|
||||
AC_SUBST(NECKO_DISK_CACHE)
|
||||
if test "$NECKO_DISK_CACHE"; then
|
||||
AC_DEFINE(NECKO_DISK_CACHE)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl option to disable necko's wifi scanner
|
||||
dnl
|
||||
|
@ -95,6 +95,7 @@ CPPSRCS = \
|
||||
nsDOMAttribute.cpp \
|
||||
nsDOMAttributeMap.cpp \
|
||||
nsDOMBlobBuilder.cpp \
|
||||
nsDOMCaretPosition.cpp \
|
||||
nsDOMDocumentType.cpp \
|
||||
nsDOMEventTargetWrapperCache.cpp \
|
||||
nsDOMFile.cpp \
|
||||
|
77
content/base/src/nsDOMCaretPosition.cpp
Normal file
77
content/base/src/nsDOMCaretPosition.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brad Lassey <blassey@mozilla.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 ***** */
|
||||
|
||||
#include "nsDOMCaretPosition.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCaretPosition)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCaretPosition)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCaretPosition)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CaretPosition)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsDOMCaretPosition, mNode)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCaretPosition)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCaretPosition)
|
||||
|
||||
DOMCI_DATA(CaretPosition, nsDOMCaretPosition)
|
||||
|
||||
|
||||
nsDOMCaretPosition::nsDOMCaretPosition(nsIDOMNode* aNode, PRUint32 aOffset)
|
||||
: mNode(aNode), mOffset(aOffset)
|
||||
{
|
||||
}
|
||||
|
||||
nsDOMCaretPosition::~nsDOMCaretPosition()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMCaretPosition::GetOffsetNode(nsIDOMNode** aOffsetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node = mNode;
|
||||
node.forget(aOffsetNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDOMCaretPosition::GetOffset(PRUint32* aOffset)
|
||||
{
|
||||
*aOffset = mOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
59
content/base/src/nsDOMCaretPosition.h
Normal file
59
content/base/src/nsDOMCaretPosition.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brad Lassey <blassey@mozilla.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 nsDOMCaretPosition_h
|
||||
#define nsDOMCaretPosition_h
|
||||
|
||||
#include "nsIDOMCaretPosition.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsDOMCaretPosition : public nsIDOMCaretPosition
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMCaretPosition)
|
||||
NS_DECL_NSIDOMCARETPOSITION
|
||||
|
||||
nsDOMCaretPosition(nsIDOMNode* aNode, PRUint32 aOffset);
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMCaretPosition();
|
||||
PRUint32 mOffset;
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
};
|
||||
#endif
|
@ -202,9 +202,13 @@
|
||||
#include "nsDOMTouchEvent.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsFrame.h"
|
||||
|
||||
#include "imgILoader.h"
|
||||
|
||||
#include "nsDOMCaretPosition.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -8394,6 +8398,58 @@ nsDocument::CreateTouchList(nsIVariant* aPoints,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::CaretPositionFromPoint(float aX, float aY, nsIDOMCaretPosition** aCaretPos)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCaretPos);
|
||||
*aCaretPos = nsnull;
|
||||
|
||||
nscoord x = nsPresContext::CSSPixelsToAppUnits(aX);
|
||||
nscoord y = nsPresContext::CSSPixelsToAppUnits(aY);
|
||||
nsPoint pt(x, y);
|
||||
|
||||
nsIPresShell *ps = GetShell();
|
||||
if (!ps) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame *rootFrame = ps->GetRootFrame();
|
||||
|
||||
// XUL docs, unlike HTML, have no frame tree until everything's done loading
|
||||
if (!rootFrame) {
|
||||
return NS_OK; // return null to premature XUL callers as a reminder to wait
|
||||
}
|
||||
|
||||
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, PR_TRUE,
|
||||
PR_FALSE);
|
||||
if (!ptFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFrame::ContentOffsets offsets = ptFrame->GetContentOffsetsFromPoint(pt);
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(offsets.content);
|
||||
nsIContent* ptContent = offsets.content;
|
||||
PRInt32 offset = offsets.offset;
|
||||
if (ptContent && ptContent->IsInNativeAnonymousSubtree()) {
|
||||
nsIContent* nonanon = ptContent->FindFirstNonNativeAnonymous();
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(nonanon);
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(nonanon);
|
||||
PRBool isText;
|
||||
if (textArea || (input &&
|
||||
NS_SUCCEEDED(input->MozIsTextField(PR_FALSE, &isText)) &&
|
||||
isText)) {
|
||||
node = do_QueryInterface(nonanon);
|
||||
} else {
|
||||
node = nsnull;
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*aCaretPos = new nsDOMCaretPosition(node, offset);
|
||||
NS_ADDREF(*aCaretPos);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsIDocument::SizeOf() const
|
||||
{
|
||||
|
@ -1059,8 +1059,9 @@ nsINode::AddEventListener(const nsAString& aType,
|
||||
|
||||
nsEventListenerManager* listener_manager = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(listener_manager);
|
||||
return listener_manager->AddEventListener(aType, aListener, aUseCapture,
|
||||
aWantsUntrusted);
|
||||
listener_manager->AddEventListener(aType, aListener, aUseCapture,
|
||||
aWantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1874,6 +1874,7 @@ GK_ATOM(images_in_menus, "images-in-menus")
|
||||
GK_ATOM(images_in_buttons, "images-in-buttons")
|
||||
GK_ATOM(windows_default_theme, "windows-default-theme")
|
||||
GK_ATOM(mac_graphite_theme, "mac-graphite-theme")
|
||||
GK_ATOM(mac_lion_theme, "mac-lion-theme")
|
||||
GK_ATOM(windows_compositor, "windows-compositor")
|
||||
GK_ATOM(touch_enabled, "touch-enabled")
|
||||
GK_ATOM(maemo_classic, "maemo-classic")
|
||||
@ -1899,6 +1900,7 @@ GK_ATOM(_moz_images_in_menus, "-moz-images-in-menus")
|
||||
GK_ATOM(_moz_images_in_buttons, "-moz-images-in-buttons")
|
||||
GK_ATOM(_moz_windows_default_theme, "-moz-windows-default-theme")
|
||||
GK_ATOM(_moz_mac_graphite_theme, "-moz-mac-graphite-theme")
|
||||
GK_ATOM(_moz_mac_lion_theme, "-moz-mac-lion-theme")
|
||||
GK_ATOM(_moz_windows_compositor, "-moz-windows-compositor")
|
||||
GK_ATOM(_moz_windows_classic, "-moz-windows-classic")
|
||||
GK_ATOM(_moz_windows_theme, "-moz-windows-theme")
|
||||
|
@ -503,6 +503,7 @@ _TEST_FILES2 = \
|
||||
test_bug666604.html \
|
||||
test_bug675121.html \
|
||||
file_bug675121.sjs \
|
||||
test_bug654352.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
50
content/base/test/test_bug654352.html
Normal file
50
content/base/test/test_bug654352.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=654352
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 654352</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=654352">Mozilla Bug 654352</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 654352 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function afterLoad() {
|
||||
var testpre = document.getElementById("testpre");
|
||||
var rect1 = testpre.getBoundingClientRect();
|
||||
dump(rect1 + "\n");
|
||||
var caret1 = document.caretPositionFromPoint(rect1.right - 5, rect1.top + 10);
|
||||
ok(caret1.offsetNode == testpre.firstChild, "node in CaretPosition not correct (" + caret1.offsetNode + " == " + testpre.firstChild + ")")
|
||||
ok(caret1.offset == 9, "offset in CaretPosition not correct (" + caret1.offset + "== 9)")
|
||||
|
||||
var testinput = document.getElementById("testinput");
|
||||
var rect2 = testinput.getBoundingClientRect();
|
||||
dump(rect2.top +", " + rect2.left + "\n");
|
||||
var caret2 = document.caretPositionFromPoint( rect2.right - 5, rect2.top + 10);
|
||||
ok(caret2.offsetNode == testinput, "node in CaretPosition not correct (" + caret2.offsetNode + " == " + testinput + ")")
|
||||
ok(caret2.offset == 9, "offset in CaretPosition not correct (" + caret2.offset + "== 9)")
|
||||
SimpleTest.finish();
|
||||
};
|
||||
addLoadEvent(afterLoad);
|
||||
</script>
|
||||
</pre>
|
||||
<span id="testdiv">
|
||||
<pre id="testpre">test text</pre>
|
||||
</span>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<input id="testinput" type="text" value="test text"></input>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -53,8 +53,8 @@ function testCopyPaste () {
|
||||
|
||||
function copySelectionToClipboard() {
|
||||
documentViewer.copySelection();
|
||||
is(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), true);
|
||||
is(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), true);
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), "check text/unicode");
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), "check text/html");
|
||||
}
|
||||
function copyToClipboard(node) {
|
||||
textarea.blur();
|
||||
|
@ -126,7 +126,8 @@ nsDOMEventTargetHelper::AddEventListener(const nsAString& aType,
|
||||
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(elm);
|
||||
return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -209,14 +209,17 @@ nsEventListenerManager::GetInnerWindowForTarget()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
PRInt32 aFlags)
|
||||
{
|
||||
NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aType, NS_ERROR_FAILURE);
|
||||
NS_ABORT_IF_FALSE(aType && aTypeAtom, "Missing type");
|
||||
|
||||
if (!aListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsIDOMEventListener> kungFuDeathGrip = aListener;
|
||||
|
||||
@ -226,7 +229,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
ls = &mListeners.ElementAt(i);
|
||||
if (ls->mListener == aListener && ls->mFlags == aFlags &&
|
||||
EVENT_TYPE_EQUALS(ls, aType, aTypeAtom)) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,8 +294,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
if (window)
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -334,14 +335,14 @@ ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent)
|
||||
(aLs->mEventType == aEvent->message);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& aType,
|
||||
PRInt32 aFlags)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aType);
|
||||
PRUint32 type = nsContentUtils::GetEventId(atom);
|
||||
return AddEventListener(aListener, type, atom, aFlags);
|
||||
AddEventListener(aListener, type, atom, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
@ -943,8 +944,7 @@ nsEventListenerManager::Disconnect()
|
||||
RemoveAllListeners();
|
||||
}
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
nsresult
|
||||
void
|
||||
nsEventListenerManager::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture,
|
||||
|
@ -84,10 +84,10 @@ public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsEventListenerManager)
|
||||
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture,
|
||||
PRBool aWantsUntrusted);
|
||||
void AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture,
|
||||
PRBool aWantsUntrusted);
|
||||
void RemoveEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
@ -96,9 +96,9 @@ public:
|
||||
* Sets events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
nsresult AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
PRInt32 aFlags);
|
||||
void AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
PRInt32 aFlags);
|
||||
void RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
PRInt32 aFlags);
|
||||
@ -210,10 +210,10 @@ protected:
|
||||
void *aScopeGlobal,
|
||||
nsIAtom* aName, PRBool aIsString,
|
||||
PRBool aPermitUntrustedEvents);
|
||||
nsresult AddEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
PRInt32 aFlags);
|
||||
void AddEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
PRInt32 aFlags);
|
||||
void RemoveEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aUserType,
|
||||
|
@ -280,7 +280,8 @@ nsEventListenerService::AddSystemEventListener(nsIDOMEventTarget *aTarget,
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT :
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT;
|
||||
return manager->AddEventListenerByType(aListener, aType, flags);
|
||||
manager->AddEventListenerByType(aListener, aType, flags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -107,6 +107,8 @@ _TEST_FILES = \
|
||||
test_bug662678.html \
|
||||
test_bug667919-1.html \
|
||||
test_bug667919-2.html \
|
||||
test_bug667612.html \
|
||||
empty.js \
|
||||
$(NULL)
|
||||
|
||||
#bug 585630
|
||||
|
0
content/events/test/empty.js
Normal file
0
content/events/test/empty.js
Normal file
39
content/events/test/test_bug667612.html
Normal file
39
content/events/test/test_bug667612.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=667612
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 667612</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=667612">Mozilla Bug 667612</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
xhr = new XMLHttpRequest;
|
||||
w = new Worker("empty.js");
|
||||
window.addEventListener("load", null, false);
|
||||
document.addEventListener("load", null, false);
|
||||
document.body.addEventListener("load", null, false);
|
||||
xhr.addEventListener("load", null, false);
|
||||
w.addEventListener("load", null, false);
|
||||
window.addEventListener("load", undefined, false);
|
||||
document.addEventListener("load", undefined, false);
|
||||
document.body.addEventListener("load", undefined, false);
|
||||
xhr.addEventListener("load", undefined, false);
|
||||
w.addEventListener("load", undefined, false);
|
||||
|
||||
ok(true, "didn't throw");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -96,14 +96,16 @@ v.load();
|
||||
// Load and move to another document.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
v = createVideo(test.name, test.type, "4");
|
||||
v.onloadstart = function(e) {
|
||||
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
|
||||
// delaying of the iframe's load event might interfere with the firing of our load event
|
||||
// in some confusing way. So it's simpler just to open another window.
|
||||
var w = window.open("", "testWindow", "width=400,height=400");
|
||||
w.document.body.appendChild(v);
|
||||
testWindows.push(w);
|
||||
};
|
||||
v.load(); // load started while in this document, this doc's load will block until
|
||||
// the video's finished loading (in the other document).
|
||||
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
|
||||
// delaying of the iframe's load event might interfere with the firing of our load event
|
||||
// in some confusing way. So it's simpler just to open another window.
|
||||
var w = window.open("", "testWindow", "width=400,height=400");
|
||||
w.document.body.appendChild(v);
|
||||
testWindows.push(w);
|
||||
// the video's finished loading (in the other document).
|
||||
|
||||
if (gRegisteredElements.length > 0) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -66,7 +66,6 @@ XPIDLSRCS = \
|
||||
nsIDocShellTreeOwner.idl \
|
||||
nsIDocShellHistory.idl \
|
||||
nsIGlobalHistory2.idl \
|
||||
nsIGlobalHistory3.idl \
|
||||
nsIMarkupDocumentViewer.idl \
|
||||
nsIScrollable.idl \
|
||||
nsITextScroll.idl \
|
||||
|
@ -197,7 +197,6 @@
|
||||
#include "nsISelectionDisplay.h"
|
||||
|
||||
#include "nsIGlobalHistory2.h"
|
||||
#include "nsIGlobalHistory3.h"
|
||||
|
||||
#ifdef DEBUG_DOCSHELL_FOCUS
|
||||
#include "nsEventStateManager.h"
|
||||
|
@ -1,103 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 the Mozilla gecko engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brett Wilson <brettw@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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIGlobalHistory2.idl"
|
||||
interface nsIChannel;
|
||||
|
||||
%{C++
|
||||
|
||||
// This is NOT part of the interface! It could change.
|
||||
#define NS_GECKO_FLAG_NEEDS_VERTICAL_SCROLLBAR (1 << 0)
|
||||
|
||||
%}
|
||||
|
||||
/**
|
||||
* Provides information about global history to gecko, extending GlobalHistory2
|
||||
*/
|
||||
[scriptable, uuid(24306852-c60e-49c3-a455-90f6747118ba)]
|
||||
interface nsIGlobalHistory3 : nsIGlobalHistory2
|
||||
{
|
||||
/**
|
||||
* Notifies the history system that the page loading via aOldChannel
|
||||
* redirected to aNewChannel. Implementations should generally add the URI for
|
||||
* aOldChannel to history for link coloring, but are advised not to expose it
|
||||
* in the history user interface. This function is preferred if
|
||||
* nsIGlobalHistory3 is available. Otherwise, nsIGlobalHistory2.addURI should
|
||||
* be called with redirect=true.
|
||||
*
|
||||
* This function is preferred to nsIGlobalHistory2.addURI because it provides
|
||||
* more information (including the redirect destination, channels involved,
|
||||
* and redirect flags) to the history implementation.
|
||||
*
|
||||
* For implementors of nsIGlobalHistory3: The history implementation is
|
||||
* responsible for sending NS_LINK_VISITED_EVENT_TOPIC to observers for
|
||||
* redirect pages. This notification must be sent for history consumers for
|
||||
* all non-redirect pages.
|
||||
*
|
||||
* @param aToplevel whether the URI is loaded in a top-level window. If
|
||||
* false, the load is in a subframe.
|
||||
*
|
||||
* The other params to this function are the same as those for
|
||||
* nsIChannelEventSink::OnChannelRedirect.
|
||||
*
|
||||
* Note: Implementors who wish to implement this interface but rely on
|
||||
* nsIGlobalHistory2.addURI for redirect processing may throw
|
||||
* NS_ERROR_NOT_IMPLEMENTED from this method. If they do so, then callers
|
||||
* must call nsIGlobalHistory2.addURI upon getting the
|
||||
* NS_ERROR_NOT_IMPLEMENTED result.
|
||||
*/
|
||||
void addDocumentRedirect(in nsIChannel aOldChannel,
|
||||
in nsIChannel aNewChannel,
|
||||
in PRInt32 aFlags,
|
||||
in boolean aTopLevel);
|
||||
|
||||
/**
|
||||
* Get the Gecko flags for this URI. These flags are used by Gecko as hints
|
||||
* to optimize page loading. Not all histories have them; this need not be
|
||||
* supported (just return NS_ERROR_NOT_IMPLEMENTED. These flags are opaque
|
||||
* and should not be interpreted by the history engine.
|
||||
*/
|
||||
unsigned long getURIGeckoFlags(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Set the Gecko flags for this URI. May fail if the history entry
|
||||
* doesn't have any flags or if there is no entry for the URI.
|
||||
*/
|
||||
void setURIGeckoFlags(in nsIURI aURI, in unsigned long aFlags);
|
||||
};
|
@ -323,8 +323,20 @@ function finish() {
|
||||
|
||||
// Close the test window and signal the framework that the test is done.
|
||||
let opener = window.opener;
|
||||
let SimpleTest = opener.wrappedJSObject.SimpleTest;
|
||||
|
||||
// Wait for the window to be closed before finishing the test
|
||||
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
|
||||
ww.registerNotification(function(subject, topic, data) {
|
||||
if (topic == "domwindowclosed") {
|
||||
ww.unregisterNotification(arguments.callee);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SimpleTest.finish();
|
||||
}, opener);
|
||||
}
|
||||
});
|
||||
|
||||
window.close();
|
||||
opener.wrappedJSObject.SimpleTest.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,6 +95,7 @@
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsLocation.h"
|
||||
#include "nsIDOMCaretPosition.h"
|
||||
|
||||
// Window scriptable helper includes
|
||||
#include "nsIDocShell.h"
|
||||
@ -665,6 +666,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
(DOM_DEFAULT_SCRIPTABLE_FLAGS &
|
||||
~nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE))
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CaretPosition, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(Navigator, nsNavigatorSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_PRECREATE)
|
||||
@ -2280,6 +2284,10 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CaretPosition, nsIDOMCaretPosition)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCaretPosition)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
if (nsNavigator::HasDesktopNotificationSupport()) {
|
||||
DOM_CLASSINFO_MAP_BEGIN(Navigator, nsIDOMNavigator)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigator)
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
DOMCI_CLASS(Window)
|
||||
DOMCI_CLASS(Location)
|
||||
DOMCI_CLASS(CaretPosition)
|
||||
DOMCI_CLASS(Navigator)
|
||||
DOMCI_CLASS(Plugin)
|
||||
DOMCI_CLASS(PluginArray)
|
||||
|
@ -1037,8 +1037,6 @@ nsGlobalWindow::~nsGlobalWindow()
|
||||
|
||||
CleanUp(PR_TRUE);
|
||||
|
||||
NS_ASSERTION(!mHasDeviceMotion, "Window still registered with device motion.");
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCycleCollector_DEBUG_wasFreed(static_cast<nsIScriptGlobalObject*>(this));
|
||||
#endif
|
||||
@ -1047,6 +1045,9 @@ nsGlobalWindow::~nsGlobalWindow()
|
||||
mURLProperty->ClearWindowReference();
|
||||
}
|
||||
|
||||
DisableDeviceMotionUpdates();
|
||||
mHasDeviceMotion = PR_FALSE;
|
||||
|
||||
nsLayoutStatics::Release();
|
||||
}
|
||||
|
||||
@ -1165,9 +1166,6 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreModalDialog)
|
||||
inner->CleanUp(aIgnoreModalDialog);
|
||||
}
|
||||
|
||||
DisableDeviceMotionUpdates();
|
||||
mHasDeviceMotion = PR_FALSE;
|
||||
|
||||
if (mCleanMessageManager) {
|
||||
NS_ABORT_IF_FALSE(mIsChrome, "only chrome should have msg manager cleaned");
|
||||
nsGlobalChromeWindow *asChrome = static_cast<nsGlobalChromeWindow*>(this);
|
||||
@ -7376,8 +7374,8 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
|
||||
|
||||
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(manager);
|
||||
return manager->AddEventListener(aType, aListener, aUseCapture,
|
||||
aWantsUntrusted);
|
||||
manager->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
|
@ -146,7 +146,8 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
|
||||
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(elm);
|
||||
return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
|
@ -48,6 +48,7 @@ GRE_MODULE = 1
|
||||
|
||||
SDK_XPIDLSRCS = \
|
||||
nsIDOMAttr.idl \
|
||||
nsIDOMCaretPosition.idl \
|
||||
nsIDOMCDATASection.idl \
|
||||
nsIDOMCharacterData.idl \
|
||||
nsIDOMComment.idl \
|
||||
|
@ -11,15 +11,15 @@
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
* The Original Code is mozilla.org.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James L. Nance.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* James L. Nance <jim_nance@yahoo.com>
|
||||
* Brad Lassey <blassey@mozilla.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
|
||||
@ -35,13 +35,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prio.h"
|
||||
#include "nsIDOMNode.idl"
|
||||
|
||||
typedef struct MmioFileStruct MmioFile;
|
||||
|
||||
PRStatus mmio_FileSeek(MmioFile *file, PRInt32 offset, PRSeekWhence whence);
|
||||
PRInt32 mmio_FileRead(MmioFile *file, char *dest, PRInt32 count);
|
||||
PRInt32 mmio_FileWrite(MmioFile *file, const char *src, PRInt32 count);
|
||||
PRInt32 mmio_FileTell(MmioFile *file);
|
||||
PRStatus mmio_FileClose(MmioFile *file);
|
||||
MmioFile *mmio_FileOpen(char *path, PRIntn flags, PRIntn mode);
|
||||
[scriptable, uuid(cf5ad6cf-6f49-4ca7-9b50-590d7bb27a13)]
|
||||
interface nsIDOMCaretPosition : nsISupports {
|
||||
readonly attribute nsIDOMNode offsetNode;
|
||||
readonly attribute unsigned long offset;
|
||||
};
|
@ -48,6 +48,7 @@ interface nsIDOMNodeIterator;
|
||||
interface nsIDOMNodeFilter;
|
||||
interface nsIDOMTreeWalker;
|
||||
interface nsIDOMLocation;
|
||||
interface nsIDOMCaretPosition;
|
||||
|
||||
/**
|
||||
* The nsIDOMDocument interface represents the entire HTML or XML document.
|
||||
@ -62,7 +63,7 @@ interface nsIDOMLocation;
|
||||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(10034b87-384e-4e19-902c-c4edafb899be)]
|
||||
[scriptable, uuid(d19897dc-948a-42e7-8ac6-d8a0bd141b85)]
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
@ -368,4 +369,6 @@ interface nsIDOMDocument : nsIDOMNode
|
||||
*/
|
||||
void mozSetImageElement(in DOMString aImageElementId,
|
||||
in nsIDOMElement aImageElement);
|
||||
|
||||
nsIDOMCaretPosition caretPositionFromPoint(in float x, in float y);
|
||||
};
|
||||
|
@ -305,6 +305,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
mContentFocused = PR_FALSE;
|
||||
mWidgetVisible = PR_TRUE;
|
||||
mPluginWindowVisible = PR_FALSE;
|
||||
mPluginDocumentActiveState = PR_TRUE;
|
||||
mNumCachedAttrs = 0;
|
||||
mNumCachedParams = 0;
|
||||
mCachedAttrParamNames = nsnull;
|
||||
@ -3241,7 +3242,7 @@ void nsPluginInstanceOwner::UpdateWindowPositionAndClipRect(PRBool aSetWindow)
|
||||
mPluginWindow->clipRect.left = 0;
|
||||
mPluginWindow->clipRect.top = 0;
|
||||
|
||||
if (mPluginWindowVisible) {
|
||||
if (mPluginWindowVisible && mPluginDocumentActiveState) {
|
||||
mPluginWindow->clipRect.right = mPluginWindow->width;
|
||||
mPluginWindow->clipRect.bottom = mPluginWindow->height;
|
||||
} else {
|
||||
@ -3269,6 +3270,12 @@ nsPluginInstanceOwner::UpdateWindowVisibility(PRBool aVisible)
|
||||
UpdateWindowPositionAndClipRect(PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstanceOwner::UpdateDocumentActiveState(PRBool aIsActive)
|
||||
{
|
||||
mPluginDocumentActiveState = aIsActive;
|
||||
UpdateWindowPositionAndClipRect(PR_TRUE);
|
||||
}
|
||||
#endif // XP_MACOSX
|
||||
|
||||
void
|
||||
|
@ -202,6 +202,7 @@ public:
|
||||
#else // XP_MACOSX
|
||||
void UpdateWindowPositionAndClipRect(PRBool aSetWindow);
|
||||
void UpdateWindowVisibility(PRBool aVisible);
|
||||
void UpdateDocumentActiveState(PRBool aIsActive);
|
||||
#endif // XP_MACOSX
|
||||
void CallSetWindow();
|
||||
|
||||
@ -343,6 +344,7 @@ private:
|
||||
PRPackedBool mFlash10Quirks;
|
||||
#endif
|
||||
PRPackedBool mPluginWindowVisible;
|
||||
PRPackedBool mPluginDocumentActiveState;
|
||||
|
||||
// If true, destroy the widget on destruction. Used when plugin stop
|
||||
// is being delayed to a safer point in time.
|
||||
|
@ -68,6 +68,11 @@ LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS) \
|
||||
-I$(topsrcdir)/dom/system/unix \
|
||||
$(NULL)
|
||||
endif
|
||||
ifdef MOZ_ENABLE_QTMOBILITY
|
||||
LOCAL_INCLUDES += $(MOZ_QT_CFLAGS) \
|
||||
-I$(topsrcdir)/dom/system/unix \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/android \
|
||||
|
@ -80,6 +80,10 @@
|
||||
#include "MaemoLocationProvider.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_QTMOBILITY
|
||||
#include "QTMLocationProvider.h"
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "AndroidLocationProvider.h"
|
||||
#endif
|
||||
@ -578,6 +582,12 @@ nsresult nsGeolocationService::Init()
|
||||
mProviders.AppendObject(provider);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_QTMOBILITY
|
||||
provider = new QTMLocationProvider();
|
||||
if (provider)
|
||||
mProviders.AppendObject(provider);
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
provider = new AndroidLocationProvider();
|
||||
if (provider)
|
||||
|
@ -1,15 +1,53 @@
|
||||
/* ***** 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 Network Location Provider for GLS.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@dougt.org>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
// Do not use this API without permission from Google.
|
||||
// See http://www.google.com/support/enterprise/bin/request.py?contact_type=gme&utm_campaign=en-us-ptr-mz
|
||||
// for more information.
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
var gLoggingEnabled = false;
|
||||
var gTestingEnabled = false;
|
||||
|
||||
function nowInSeconds()
|
||||
{
|
||||
return Date.now() / 1000;
|
||||
}
|
||||
let gLoggingEnabled = false;
|
||||
let gTestingEnabled = false;
|
||||
|
||||
function LOG(aMsg) {
|
||||
if (gLoggingEnabled)
|
||||
@ -20,408 +58,254 @@ function LOG(aMsg) {
|
||||
}
|
||||
}
|
||||
|
||||
function WifiGeoAddressObject(streetNumber, street, premises, city, county, region, country, countryCode, postalCode) {
|
||||
|
||||
this.streetNumber = streetNumber;
|
||||
this.street = street;
|
||||
this.premises = premises;
|
||||
this.city = city;
|
||||
this.county = county;
|
||||
this.region = region;
|
||||
this.country = country;
|
||||
this.countryCode = countryCode;
|
||||
this.postalCode = postalCode;
|
||||
}
|
||||
|
||||
WifiGeoAddressObject.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionAddress]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionAddress],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT})
|
||||
};
|
||||
|
||||
function WifiGeoCoordsObject(lat, lon, acc, alt, altacc) {
|
||||
this.latitude = lat;
|
||||
this.longitude = lon;
|
||||
this.accuracy = acc;
|
||||
this.altitude = alt;
|
||||
this.altitudeAccuracy = altacc;
|
||||
};
|
||||
this.latitude = lat;
|
||||
this.longitude = lon;
|
||||
this.accuracy = acc;
|
||||
this.altitude = alt;
|
||||
this.altitudeAccuracy = altacc;
|
||||
}
|
||||
|
||||
WifiGeoCoordsObject.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionCoords],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "wifi geo position coords object"}),
|
||||
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
accuracy: 0,
|
||||
altitude: 0,
|
||||
altitudeAccuracy: 0,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPositionCoords]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPositionCoords],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "wifi geo position coords object"}),
|
||||
};
|
||||
|
||||
function WifiGeoPositionObject(location) {
|
||||
|
||||
this.coords = new WifiGeoCoordsObject(location.latitude,
|
||||
location.longitude,
|
||||
location.accuracy || 12450, // .5 * circumference of earth.
|
||||
location.altitude || 0,
|
||||
location.altitude_accuracy || 0);
|
||||
|
||||
if (location.address) {
|
||||
let address = location.address;
|
||||
this.address = new WifiGeoAddressObject(address.street_number || null,
|
||||
address.street || null,
|
||||
address.premises || null,
|
||||
address.city || null,
|
||||
address.county || null,
|
||||
address.region || null,
|
||||
address.country || null,
|
||||
address.country_code || null,
|
||||
address.postal_code || null);
|
||||
}
|
||||
else
|
||||
this.address = null;
|
||||
|
||||
this.timestamp = Date.now();
|
||||
};
|
||||
function WifiGeoPositionObject(lat, lng, acc) {
|
||||
this.coords = new WifiGeoCoordsObject(lat, lng, acc, 0, 0);
|
||||
this.address = null;
|
||||
this.timestamp = Date.now();
|
||||
}
|
||||
|
||||
WifiGeoPositionObject.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGeoPosition]),
|
||||
|
||||
// Class Info is required to be able to pass objects back into the DOM.
|
||||
classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPosition],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "wifi geo location position object"}),
|
||||
|
||||
coords: null,
|
||||
timestamp: 0,
|
||||
// Class Info is required to be able to pass objects back into the DOM.
|
||||
classInfo: XPCOMUtils.generateCI({interfaces: [Ci.nsIDOMGeoPosition],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "wifi geo location position object"}),
|
||||
};
|
||||
|
||||
function HELD() {};
|
||||
// For information about the HELD format, see:
|
||||
// http://tools.ietf.org/html/draft-thomson-geopriv-held-measurements-05
|
||||
HELD.encode = function(requestObject) {
|
||||
// XML Header
|
||||
var requestString = "<locationRequest xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">";
|
||||
// Measurements
|
||||
if (requestObject.wifi_towers && requestObject.wifi_towers.length > 0) {
|
||||
requestString += "<measurements xmlns=\"urn:ietf:params:xml:ns:geopriv:lm\">";
|
||||
requestString += "<wifi xmlns=\"urn:ietf:params:xml:ns:geopriv:lm:wifi\">";
|
||||
for (var i=0; i < requestObject.wifi_towers.length; ++i) {
|
||||
requestString += "<neighbourWap>";
|
||||
requestString += "<bssid>" + requestObject.wifi_towers[i].mac_address + "</bssid>";
|
||||
requestString += "<ssid>" + requestObject.wifi_towers[i].ssid + "</ssid>";
|
||||
requestString += "<rssi>" + requestObject.wifi_towers[i].signal_strength + "</rssi>";
|
||||
requestString += "</neighbourWap>";
|
||||
}
|
||||
// XML Footer
|
||||
requestString += "</wifi></measurements>";
|
||||
}
|
||||
requestString += "</locationRequest>";
|
||||
return requestString;
|
||||
};
|
||||
|
||||
// Decode a HELD response into a Gears-style object
|
||||
HELD.decode = function(responseXML) {
|
||||
// Find a Circle object in PIDF-LO and decode
|
||||
function nsResolver(prefix) {
|
||||
var ns = {
|
||||
'held': 'urn:ietf:params:xml:ns:geopriv:held',
|
||||
'pres': 'urn:ietf:params:xml:ns:pidf',
|
||||
'gp': 'urn:ietf:params:xml:ns:pidf:geopriv10',
|
||||
'gml': 'http://www.opengis.net/gml',
|
||||
'gs': 'http://www.opengis.net/pidflo/1.0',
|
||||
};
|
||||
return ns[prefix] || null;
|
||||
}
|
||||
|
||||
var xpathEval = Components.classes["@mozilla.org/dom/xpath-evaluator;1"].createInstance(Ci.nsIDOMXPathEvaluator);
|
||||
|
||||
// Grab values out of XML via XPath
|
||||
var pos = xpathEval.evaluate(
|
||||
'/held:locationResponse/pres:presence/pres:tuple/pres:status/gp:geopriv/gp:location-info/gs:Circle/gml:pos',
|
||||
responseXML,
|
||||
nsResolver,
|
||||
Ci.nsIDOMXPathResult.STRING_TYPE,
|
||||
null);
|
||||
|
||||
var rad = xpathEval.evaluate(
|
||||
'/held:locationResponse/pres:presence/pres:tuple/pres:status/gp:geopriv/gp:location-info/gs:Circle/gs:radius',
|
||||
responseXML,
|
||||
nsResolver,
|
||||
Ci.nsIDOMXPathResult.NUMBER_TYPE,
|
||||
null );
|
||||
|
||||
var uom = xpathEval.evaluate(
|
||||
'/held:locationResponse/pres:presence/pres:tuple/pres:status/gp:geopriv/gp:location-info/gs:Circle/gs:radius/@uom',
|
||||
responseXML,
|
||||
nsResolver,
|
||||
Ci.nsIDOMXPathResult.STRING_TYPE,
|
||||
null);
|
||||
|
||||
// Bail if we don't have a valid result (all values && uom==meters)
|
||||
if ((pos.stringValue == null) ||
|
||||
(rad.numberValue == null) ||
|
||||
(uom.stringValue == null) ||
|
||||
(uom.stringValue != "urn:ogc:def:uom:EPSG::9001")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Split the pos value into lat/long
|
||||
var coords = pos.stringValue.split(/[ \t\n]+/);
|
||||
|
||||
// Fill out the object to return:
|
||||
var obj = {
|
||||
location: {
|
||||
latitude: parseFloat(coords[0]),
|
||||
longitude: parseFloat(coords[1]),
|
||||
accuracy: rad.numberValue
|
||||
}
|
||||
};
|
||||
return obj;
|
||||
}
|
||||
|
||||
function WifiGeoPositionProvider() {
|
||||
this.prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).QueryInterface(Ci.nsIPrefService);
|
||||
try {
|
||||
gLoggingEnabled = this.prefService.getBoolPref("geo.wifi.logging.enabled");
|
||||
} catch (e) {}
|
||||
try {
|
||||
gLoggingEnabled = Services.prefs.getBoolPref("geo.wifi.logging.enabled");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
gTestingEnabled = this.prefService.getBoolPref("geo.wifi.testing");
|
||||
} catch (e) {}
|
||||
try {
|
||||
gTestingEnabled = Services.prefs.getBoolPref("geo.wifi.testing");
|
||||
} catch (e) {}
|
||||
|
||||
};
|
||||
wifiService = null;
|
||||
timer = null;
|
||||
hasSeenWiFi = false;
|
||||
started = false;
|
||||
}
|
||||
|
||||
WifiGeoPositionProvider.prototype = {
|
||||
classID: Components.ID("{77DA64D3-7458-4920-9491-86CC9914F904}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider,
|
||||
Ci.nsIWifiListener,
|
||||
Ci.nsITimerCallback]),
|
||||
classID: Components.ID("{77DA64D3-7458-4920-9491-86CC9914F904}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider,
|
||||
Ci.nsIWifiListener,
|
||||
Ci.nsITimerCallback]),
|
||||
startup: function() {
|
||||
if (this.started)
|
||||
return;
|
||||
this.started = true;
|
||||
this.hasSeenWiFi = false;
|
||||
|
||||
prefService: null,
|
||||
wifi_service: null,
|
||||
timer: null,
|
||||
hasSeenWiFi: false,
|
||||
started: false,
|
||||
LOG("startup called. testing mode is" + gTestingEnabled);
|
||||
|
||||
startup: function() {
|
||||
if (this.started == true)
|
||||
return;
|
||||
// if we don't see anything in 5 seconds, kick of one IP geo lookup.
|
||||
// if we are testing, just hammer this callback so that we are more or less
|
||||
// always sending data. It doesn't matter if we have an access point or not.
|
||||
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
if (!gTestingEnabled)
|
||||
this.timer.initWithCallback(this, 5000, this.timer.TYPE_ONE_SHOT);
|
||||
else
|
||||
this.timer.initWithCallback(this, 200, this.timer.TYPE_REPEATING_SLACK);
|
||||
},
|
||||
|
||||
this.started = true;
|
||||
watch: function(c) {
|
||||
LOG("watch called");
|
||||
if (!this.wifiService) {
|
||||
this.wifiService = Cc["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
|
||||
this.wifiService.startWatching(this);
|
||||
}
|
||||
},
|
||||
|
||||
LOG("startup called. testing mode is" + gTestingEnabled);
|
||||
// if we don't see anything in 5 seconds, kick of one IP geo lookup.
|
||||
// if we are testing, just hammer this callback so that we are more or less
|
||||
// always sending data. It doesn't matter if we have an access point or not.
|
||||
this.hasSeenWiFi = false;
|
||||
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
if (gTestingEnabled == false)
|
||||
this.timer.initWithCallback(this, 5000, this.timer.TYPE_ONE_SHOT);
|
||||
else
|
||||
this.timer.initWithCallback(this, 200, this.timer.TYPE_REPEATING_SLACK);
|
||||
},
|
||||
shutdown: function() {
|
||||
LOG("shutdown called");
|
||||
if(this.wifiService) {
|
||||
this.wifiService.stopWatching(this);
|
||||
this.wifiService = null;
|
||||
}
|
||||
if (this.timer != null) {
|
||||
this.timer.cancel();
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
watch: function(c) {
|
||||
LOG("watch called");
|
||||
if (!this.wifi_service) {
|
||||
this.wifi_service = Cc["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
|
||||
this.wifi_service.startWatching(this);
|
||||
}
|
||||
},
|
||||
// Although we aren't using cookies, we should err on the side of not
|
||||
// saving any access tokens if the user asked us not to save cookies or
|
||||
// has changed the lifetimePolicy. The access token in these cases is
|
||||
// used and valid for the life of this object (eg. between startup and
|
||||
// shutdown).
|
||||
if (Services.prefs.getIntPref("network.cookie.lifetimePolicy") != 0)
|
||||
Services.prefs.deleteBranch("geo.wifi.access_token.");
|
||||
this.started = false;
|
||||
},
|
||||
|
||||
shutdown: function() {
|
||||
LOG("shutdown called");
|
||||
if(this.wifi_service)
|
||||
this.wifi_service.stopWatching(this);
|
||||
this.wifi_service = null;
|
||||
getAccessTokenForURL: function(url)
|
||||
{
|
||||
// check to see if we have an access token:
|
||||
let accessToken = "";
|
||||
try {
|
||||
let accessTokenPrefName = "geo.wifi.access_token." + url;
|
||||
accessToken = Services.prefs.getCharPref(accessTokenPrefName);
|
||||
|
||||
if (this.timer != null) {
|
||||
this.timer.cancel();
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
// Although we aren't using cookies, we should err on the side of not
|
||||
// saving any access tokens if the user asked us not to save cookies or
|
||||
// has changed the lifetimePolicy. The access token in these cases is
|
||||
// used and valid for the life of this object (eg. between startup and
|
||||
// shutdown).e
|
||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
if (prefBranch.getIntPref("network.cookie.lifetimePolicy") != 0)
|
||||
prefBranch.deleteBranch("geo.wifi.access_token.");
|
||||
|
||||
this.started = false;
|
||||
},
|
||||
|
||||
getAccessTokenForURL: function(url)
|
||||
{
|
||||
// check to see if we have an access token:
|
||||
var accessToken = "";
|
||||
|
||||
try {
|
||||
var accessTokenPrefName = "geo.wifi.access_token." + url;
|
||||
accessToken = this.prefService.getCharPref(accessTokenPrefName);
|
||||
// check to see if it has expired
|
||||
let accessTokenDate = Services.prefs.getIntPref(accessTokenPrefName + ".time");
|
||||
|
||||
let accessTokenInterval = 1209600; // seconds in 2 weeks
|
||||
try {
|
||||
accessTokenInterval = Services.prefs.getIntPref("geo.wifi.access_token.recycle_interval");
|
||||
} catch (e) {}
|
||||
|
||||
// check to see if it has expired
|
||||
var accessTokenDate = this.prefService.getIntPref(accessTokenPrefName + ".time");
|
||||
|
||||
var accessTokenInterval = 1209600; /* seconds in 2 weeks */
|
||||
try {
|
||||
accessTokenInterval = this.prefService.getIntPref("geo.wifi.access_token.recycle_interval");
|
||||
} catch (e) {}
|
||||
|
||||
if (nowInSeconds() - accessTokenDate > accessTokenInterval)
|
||||
accessToken = "";
|
||||
if ((Date.now() / 1000) - accessTokenDate > accessTokenInterval)
|
||||
accessToken = "";
|
||||
}
|
||||
catch (e) {
|
||||
accessToken = "";
|
||||
}
|
||||
return accessToken;
|
||||
},
|
||||
|
||||
onChange: function(accessPoints) {
|
||||
LOG("onChange called");
|
||||
this.hasSeenWiFi = true;
|
||||
|
||||
let providerUrlBase = Services.prefs.getCharPref("geo.wifi.uri");
|
||||
let providerUrl;
|
||||
|
||||
let query = providerUrlBase.indexOf("?");
|
||||
if (query == -1)
|
||||
providerUrl = providerUrlBase + "?"
|
||||
else
|
||||
providerUrl = providerUrlBase + "&";
|
||||
providerUrl = providerUrl + "browser=firefox&sensor=true";
|
||||
|
||||
|
||||
let accessToken = this.getAccessTokenForURL(providerUrlBase);
|
||||
if (accessToken !== "")
|
||||
providerUrl = providerUrl + "&access_token="+access_token;
|
||||
|
||||
function sort(a, b) {
|
||||
return b.signal - a.signal;
|
||||
};
|
||||
|
||||
function encode(ap) {
|
||||
// make sure that the ssid doesn't contain any | chars.
|
||||
ap.ssid = ap.ssid.replace("|", "\\|");
|
||||
// gls service parses the | as fields
|
||||
return "&wifi=mac:"+ap.mac+"|ssid:"+ap.ssid+"|ss:"+ap.signal;
|
||||
};
|
||||
|
||||
if (accessPoints) {
|
||||
accessPoints.sort(sort).map(encode).join("");
|
||||
// max length is 2k. make sure we are under that
|
||||
let x = providerUrl.length - 2000;
|
||||
if (x >= 0) {
|
||||
// we need to trim
|
||||
let doomed = providerUrl.lastIndexOf("&", 2000);
|
||||
LOG("Doomed:"+doomed);
|
||||
providerUrl = providerUrl.substring(0, doomed);
|
||||
}
|
||||
catch (e) {
|
||||
accessToken = "";
|
||||
}
|
||||
return accessToken;
|
||||
},
|
||||
}
|
||||
|
||||
onChange: function(accessPoints) {
|
||||
providerUrl = encodeURI(providerUrl);
|
||||
LOG("************************************* Sending request:\n" + providerUrl + "\n");
|
||||
|
||||
LOG("onChange called");
|
||||
this.hasSeenWiFi = true;
|
||||
// send our request to a wifi geolocation network provider:
|
||||
let xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
|
||||
// send our request to a wifi geolocation network provider:
|
||||
var xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
// This is a background load
|
||||
xhr.mozBackgroundRequest = true;
|
||||
xhr.open("GET", providerUrl, false);
|
||||
xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS;
|
||||
xhr.onerror = function(req) {
|
||||
LOG("onerror: " + req);
|
||||
};
|
||||
xhr.onload = function (req) {
|
||||
LOG("service returned: " + req.target.responseText);
|
||||
response = JSON.parse(req.target.responseText);
|
||||
/*
|
||||
{
|
||||
"status": "OK",
|
||||
"accuracy": 150.0,
|
||||
"location": {
|
||||
"lat": -33.85702,
|
||||
"lng": 151.21494
|
||||
},
|
||||
"access_token": "quijibo"
|
||||
}
|
||||
*/
|
||||
|
||||
// This is a background load
|
||||
xhr.mozBackgroundRequest = true;
|
||||
if (response.status != "OK")
|
||||
return;
|
||||
|
||||
var provider_url = this.prefService.getCharPref("geo.wifi.uri");
|
||||
var provider_protocol = 0;
|
||||
try {
|
||||
provider_protocol = this.prefService.getIntPref("geo.wifi.protocol");
|
||||
} catch (e) {}
|
||||
if (response.location) {
|
||||
let newLocation = new WifiGeoPositionObject(response.location.lat,
|
||||
response.location.lng,
|
||||
response.accuracy);
|
||||
|
||||
LOG("provider url = " + provider_url);
|
||||
|
||||
xhr.open("POST", provider_url, false);
|
||||
|
||||
// set something so that we can strip cookies
|
||||
xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS;
|
||||
|
||||
xhr.onerror = function(req) {
|
||||
LOG("onerror: " + req);
|
||||
};
|
||||
|
||||
xhr.onload = function (req) {
|
||||
|
||||
LOG("xhr onload...");
|
||||
|
||||
try {
|
||||
// if we get a bad response, we will throw and never report a location
|
||||
var response;
|
||||
switch (provider_protocol) {
|
||||
case 1:
|
||||
LOG("service returned: " + req.target.responseXML);
|
||||
response = HELD.decode(req.target.responseXML);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
LOG("service returned: " + req.target.responseText);
|
||||
response = JSON.parse(req.target.responseText);
|
||||
}
|
||||
} catch (e) {
|
||||
LOG("Parse failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// response looks something like:
|
||||
// {"location":{"latitude":51.5090332,"longitude":-0.1212726,"accuracy":150.0},"access_token":"2:jVhRZJ-j6PiRchH_:RGMrR0W1BiwdZs12"}
|
||||
|
||||
// Check to see if we have a new access token
|
||||
var newAccessToken = response.access_token;
|
||||
if (newAccessToken != undefined)
|
||||
{
|
||||
var prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
var accessToken = "";
|
||||
var accessTokenPrefName = "geo.wifi.access_token." + req.target.channel.URI.spec;
|
||||
try { accessToken = prefService.getCharPref(accessTokenPrefName); } catch (e) {}
|
||||
|
||||
if (accessToken != newAccessToken) {
|
||||
// no match, lets cache
|
||||
LOG("New Access Token: " + newAccessToken + "\n" + accessTokenPrefName);
|
||||
|
||||
try {
|
||||
prefService.setIntPref(accessTokenPrefName + ".time", nowInSeconds());
|
||||
prefService.setCharPref(accessTokenPrefName, newAccessToken);
|
||||
} catch (x) {
|
||||
// XXX temporary hack for bug 575346 to allow geolocation to function
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (response.location) {
|
||||
var newLocation = new WifiGeoPositionObject(response.location);
|
||||
|
||||
var update = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationUpdate);
|
||||
update.update(newLocation);
|
||||
}
|
||||
};
|
||||
|
||||
var accessToken = this.getAccessTokenForURL(provider_url);
|
||||
|
||||
var request = {
|
||||
version: "1.1.0",
|
||||
request_address: true,
|
||||
};
|
||||
|
||||
if (accessToken != "")
|
||||
request.access_token = accessToken;
|
||||
|
||||
if (accessPoints != null) {
|
||||
function filterBlankSSIDs(ap) ap.ssid != ""
|
||||
function deconstruct(ap) ({
|
||||
mac_address: ap.mac,
|
||||
ssid: ap.ssid,
|
||||
signal_strength: ap.signal
|
||||
})
|
||||
request.wifi_towers = accessPoints.filter(filterBlankSSIDs).map(deconstruct);
|
||||
let update = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationUpdate);
|
||||
update.update(newLocation);
|
||||
}
|
||||
|
||||
var requestString;
|
||||
switch (provider_protocol) {
|
||||
case 1:
|
||||
requestString = HELD.encode(request);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
requestString = JSON.stringify(request);
|
||||
}
|
||||
LOG("client sending: " + requestString);
|
||||
|
||||
try {
|
||||
xhr.send(requestString);
|
||||
} catch (e) {}
|
||||
},
|
||||
// Check to see if we have a new access token
|
||||
let newAccessToken = response.access_token;
|
||||
if (newAccessToken !== undefined)
|
||||
{
|
||||
let accessToken = "";
|
||||
let accessTokenPrefName = "geo.wifi.access_token." + providerUrlBase;
|
||||
try { accessToken = Services.prefs.getCharPref(accessTokenPrefName); } catch (e) {}
|
||||
|
||||
onError: function (code) {
|
||||
LOG("wifi error: " + code);
|
||||
},
|
||||
|
||||
notify: function (timer) {
|
||||
if (!gTestingEnabled) {
|
||||
if (this.hasSeenWiFi == false)
|
||||
this.onChange(null);
|
||||
this.timer = null;
|
||||
return;
|
||||
if (accessToken != newAccessToken) {
|
||||
// no match, lets cache
|
||||
LOG("New Access Token: " + newAccessToken + "\n" + accessTokenPrefName);
|
||||
try {
|
||||
Services.prefs.setIntPref(accessTokenPrefName + ".time", nowInSeconds());
|
||||
Services.prefs.setCharPref(accessTokenPrefName, newAccessToken);
|
||||
} catch (x) {
|
||||
// XXX temporary hack for bug 575346 to allow geolocation to function
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we are testing, we need to hammer this.
|
||||
};
|
||||
|
||||
LOG("************************************* ------>>>> sending.");
|
||||
xhr.send(null);
|
||||
},
|
||||
|
||||
onError: function (code) {
|
||||
LOG("wifi error: " + code);
|
||||
},
|
||||
|
||||
notify: function (timer) {
|
||||
if (gTestingEnabled) {
|
||||
// if we are testing, timer is repeating
|
||||
this.onChange(null);
|
||||
}
|
||||
else {
|
||||
if (!this.hasSeenWiFi)
|
||||
this.onChange(null);
|
||||
},
|
||||
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);
|
||||
let NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);
|
||||
|
@ -50,6 +50,8 @@ FORCE_STATIC_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
nsDeviceMotionSystem.cpp \
|
||||
@ -67,7 +69,12 @@ CPPSRCS += nsHapticFeedback.cpp
|
||||
LOCAL_INCLUDES += $(MOZ_DBUS_CFLAGS) \
|
||||
$(NULL)
|
||||
ifdef MOZ_ENABLE_QTMOBILITY
|
||||
MOCSRCS += moc_QTMLocationProvider.cpp
|
||||
CPPSRCS += $(MOCSRCS) \
|
||||
QTMLocationProvider.cpp \
|
||||
$(NULL)
|
||||
LOCAL_INCLUDES += $(MOZ_QT_CFLAGS) \
|
||||
-I$(topsrcdir)/dom/src/geolocation \
|
||||
$(NULL)
|
||||
endif
|
||||
endif
|
||||
|
118
dom/system/unix/QTMLocationProvider.cpp
Normal file
118
dom/system/unix/QTMLocationProvider.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* ***** 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 Qt code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Oleg Romashin <romaxa@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 ***** */
|
||||
|
||||
#include "QTMLocationProvider.h"
|
||||
#include "nsGeoPosition.h"
|
||||
#include <QFeedbackEffect>
|
||||
using namespace QtMobility;
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(QTMLocationProvider, nsIGeolocationProvider)
|
||||
|
||||
QTMLocationProvider::QTMLocationProvider()
|
||||
{
|
||||
mLocation = QGeoPositionInfoSource::createDefaultSource(this);
|
||||
if (mLocation)
|
||||
connect(mLocation, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
|
||||
}
|
||||
|
||||
QTMLocationProvider::~QTMLocationProvider()
|
||||
{
|
||||
delete mLocation;
|
||||
}
|
||||
|
||||
void
|
||||
QTMLocationProvider::positionUpdated(const QGeoPositionInfo &geoPosition)
|
||||
{
|
||||
if (!geoPosition.isValid()) {
|
||||
NS_WARNING("Invalida geoposition received");
|
||||
return;
|
||||
}
|
||||
|
||||
QGeoCoordinate coord = geoPosition.coordinate();
|
||||
double latitude = coord.latitude();
|
||||
double longitude = coord.longitude();
|
||||
double altitude = coord.altitude();
|
||||
double accuracy = geoPosition.attribute(QGeoPositionInfo::HorizontalAccuracy);
|
||||
double altitudeAccuracy = geoPosition.attribute(QGeoPositionInfo::VerticalAccuracy);
|
||||
double heading = geoPosition.attribute(QGeoPositionInfo::Direction);
|
||||
|
||||
bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed);
|
||||
double speed = geoPosition.attribute(QGeoPositionInfo::GroundSpeed);
|
||||
|
||||
nsRefPtr<nsGeoPosition> p =
|
||||
new nsGeoPosition(latitude, longitude,
|
||||
altitude, accuracy,
|
||||
altitudeAccuracy, heading,
|
||||
speed, geoPosition.timestamp().toTime_t());
|
||||
if (mCallback) {
|
||||
mCallback->Update(p);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
QTMLocationProvider::Startup()
|
||||
{
|
||||
if (!mLocation)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
mLocation->startUpdates();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
QTMLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
|
||||
{
|
||||
mCallback = aCallback;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
QTMLocationProvider::Shutdown()
|
||||
{
|
||||
if (!mLocation)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
mLocation->stopUpdates();
|
||||
mCallback = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
69
dom/system/unix/QTMLocationProvider.h
Normal file
69
dom/system/unix/QTMLocationProvider.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* ***** 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 Qt code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Oleg Romashin <romaxa@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 QTMLocationProvider_h
|
||||
#define QTMLocationProvider_h
|
||||
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "nsGeolocation.h"
|
||||
#include "nsIGeolocationProvider.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
using namespace QtMobility;
|
||||
|
||||
class QTMLocationProvider : public QObject,
|
||||
public nsIGeolocationProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIGEOLOCATIONPROVIDER
|
||||
|
||||
QTMLocationProvider();
|
||||
|
||||
public Q_SLOTS:
|
||||
// QGeoPositionInfoSource
|
||||
void positionUpdated(const QGeoPositionInfo&);
|
||||
|
||||
private:
|
||||
~QTMLocationProvider();
|
||||
|
||||
QtMobility::QGeoPositionInfoSource* mLocation;
|
||||
nsCOMPtr<nsIGeolocationUpdate> mCallback;
|
||||
};
|
||||
|
||||
#endif /* QTMLocationProvider_h */
|
@ -77,15 +77,15 @@ function check_geolocation(location) {
|
||||
|
||||
ok("latitude" in coords, "Check to see if there is a latitude");
|
||||
ok("longitude" in coords, "Check to see if there is a longitude");
|
||||
ok("altitude" in coords, "Check to see if there is a altitude");
|
||||
ok("accuracy" in coords, "Check to see if there is a accuracy");
|
||||
ok("altitudeAccuracy" in coords, "Check to see if there is a alt accuracy");
|
||||
|
||||
|
||||
// optional ok("altitude" in coords, "Check to see if there is a altitude");
|
||||
// optional ok("altitudeAccuracy" in coords, "Check to see if there is a alt accuracy");
|
||||
// optional ok("heading" in coords, "Check to see if there is a heading");
|
||||
// optional ok("speed" in coords, "Check to see if there is a speed");
|
||||
|
||||
ok (location.coords.latitude == 37.41857, "lat matches known value");
|
||||
ok (location.coords.longitude == -122.08769, "lon matches known value");
|
||||
ok(location.coords.altitude == 42, "alt matches known value");
|
||||
ok(location.coords.altitudeAccuracy == 42, "alt acc matches known value");
|
||||
// optional ok(location.coords.altitude == 42, "alt matches known value");
|
||||
// optional ok(location.coords.altitudeAccuracy == 42, "alt acc matches known value");
|
||||
}
|
||||
|
@ -19,35 +19,16 @@ function parseQueryString(str)
|
||||
|
||||
function getPosition(action)
|
||||
{
|
||||
// this isn't the w3c data structure, it is the network location provider structure.
|
||||
|
||||
var address = {
|
||||
street_number: "street_number",
|
||||
street: "street",
|
||||
premises: "premises",
|
||||
city: "city",
|
||||
county: "county",
|
||||
region: "region",
|
||||
country: "country",
|
||||
country_code: "country_code",
|
||||
postal_code: "postal_code",
|
||||
};
|
||||
|
||||
|
||||
var coords = {
|
||||
latitude: 37.41857,
|
||||
longitude: -122.08769,
|
||||
|
||||
altitude: 42,
|
||||
var response = {
|
||||
status: "OK",
|
||||
location: {
|
||||
lat: 37.41857,
|
||||
lng: -122.08769,
|
||||
},
|
||||
accuracy: (action == "worse-accuracy") ? 100 : 42,
|
||||
altitude_accuracy: 42,
|
||||
};
|
||||
|
||||
var geoposition = {
|
||||
location: coords,
|
||||
};
|
||||
|
||||
return JSON.stringify(geoposition);
|
||||
return JSON.stringify(response);
|
||||
}
|
||||
|
||||
function handleRequest(request, response)
|
||||
|
@ -431,7 +431,8 @@ nsRemoveListCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
{
|
||||
// It is enabled if we are in any list type
|
||||
@ -543,7 +544,8 @@ nsOutdentCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor && htmlEditor)
|
||||
{
|
||||
PRBool canIndent, isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return htmlEditor->GetIndentState(&canIndent, outCmdEnabled);
|
||||
}
|
||||
@ -1051,7 +1053,8 @@ nsAbsolutePositioningCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (htmlEditor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return htmlEditor->GetAbsolutePositioningEnabled(outCmdEnabled);
|
||||
}
|
||||
|
@ -71,7 +71,8 @@ nsUndoCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEnabled, isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanUndo(&isEnabled, outCmdEnabled);
|
||||
}
|
||||
@ -119,7 +120,8 @@ nsRedoCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEnabled, isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanRedo(&isEnabled, outCmdEnabled);
|
||||
}
|
||||
@ -215,7 +217,8 @@ nsCutCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanCut(outCmdEnabled);
|
||||
}
|
||||
@ -319,7 +322,8 @@ nsCopyCommand::IsCommandEnabled(const char * aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanCopy(outCmdEnabled);
|
||||
}
|
||||
@ -422,7 +426,8 @@ nsPasteCommand::IsCommandEnabled(const char *aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanPaste(nsIClipboard::kGlobalClipboard, outCmdEnabled);
|
||||
}
|
||||
@ -469,7 +474,8 @@ nsPasteTransferableCommand::IsCommandEnabled(const char *aCommandName,
|
||||
if (editor)
|
||||
{
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isEditable)
|
||||
return editor->CanPasteTransferable(nsnull, outCmdEnabled);
|
||||
}
|
||||
@ -580,7 +586,8 @@ nsDeleteCommand::IsCommandEnabled(const char * aCommandName,
|
||||
NS_ENSURE_TRUE(editor, NS_OK);
|
||||
|
||||
PRBool isEditable = PR_FALSE;
|
||||
NS_SUCCEEDED(editor->GetIsSelectionEditable(&isEditable));
|
||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!isEditable)
|
||||
return NS_OK;
|
||||
|
@ -126,78 +126,62 @@ nsEditorEventListener::InstallToEditor()
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget = mEditor->GetDOMEventTarget();
|
||||
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// register the event listeners with the listener manager
|
||||
nsEventListenerManager* elmP = piTarget->GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(elmP);
|
||||
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("keypress"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_PRIV_EVENT_UNTRUSTED_PERMITTED |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("keypress"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_PRIV_EVENT_UNTRUSTED_PERMITTED |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
// See bug 455215, we cannot use the standard dragstart event yet
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("draggesture"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragenter"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragover"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragexit"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("drop"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("mousedown"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("mouseup"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("click"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Focus event doesn't bubble so adding the listener to capturing phase.
|
||||
// Make sure this works after bug 235441 gets fixed.
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("blur"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("focus"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("text"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("compositionstart"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("compositionend"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("draggesture"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragenter"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragover"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("dragexit"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("drop"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("mousedown"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("mouseup"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("click"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
// Focus event doesn't bubble so adding the listener to capturing phase.
|
||||
// Make sure this works after bug 235441 gets fixed.
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("blur"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("focus"),
|
||||
NS_EVENT_FLAG_CAPTURE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("text"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("compositionstart"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
elmP->AddEventListenerByType(this,
|
||||
NS_LITERAL_STRING("compositionend"),
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ import android.telephony.*;
|
||||
abstract public class GeckoApp
|
||||
extends Activity
|
||||
{
|
||||
private static final String LOG_FILE_NAME = "GeckoApp";
|
||||
|
||||
public static final String ACTION_ALERT_CLICK = "org.mozilla.gecko.ACTION_ALERT_CLICK";
|
||||
public static final String ACTION_ALERT_CLEAR = "org.mozilla.gecko.ACTION_ALERT_CLEAR";
|
||||
public static final String ACTION_WEBAPP = "org.mozilla.gecko.WEBAPP";
|
||||
@ -151,13 +153,13 @@ abstract public class GeckoApp
|
||||
try {
|
||||
unpackComponents();
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
Log.e("GeckoApp", "error unpacking components", fnfe);
|
||||
Log.e(LOG_FILE_NAME, "error unpacking components", fnfe);
|
||||
Looper.prepare();
|
||||
showErrorDialog(getString(R.string.error_loading_file));
|
||||
Looper.loop();
|
||||
return;
|
||||
} catch (IOException ie) {
|
||||
Log.e("GeckoApp", "error unpacking components", ie);
|
||||
Log.e(LOG_FILE_NAME, "error unpacking components", ie);
|
||||
String msg = ie.getMessage();
|
||||
Looper.prepare();
|
||||
if (msg != null && msg.equalsIgnoreCase("No space left on device"))
|
||||
@ -175,7 +177,7 @@ abstract public class GeckoApp
|
||||
i.getStringExtra("args"),
|
||||
i.getDataString());
|
||||
} catch (Exception e) {
|
||||
Log.e("GeckoApp", "top level exception", e);
|
||||
Log.e(LOG_FILE_NAME, "top level exception", e);
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
GeckoAppShell.reportJavaCrash(sw.toString());
|
||||
@ -199,7 +201,7 @@ abstract public class GeckoApp
|
||||
try {
|
||||
Looper.loop();
|
||||
} catch (Exception e) {
|
||||
Log.e("GeckoApp", "top level exception", e);
|
||||
Log.e(LOG_FILE_NAME, "top level exception", e);
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
GeckoAppShell.reportJavaCrash(sw.toString());
|
||||
@ -215,7 +217,7 @@ abstract public class GeckoApp
|
||||
if (localeCode != null && localeCode.length() > 0)
|
||||
GeckoAppShell.setSelectedLocale(localeCode);
|
||||
|
||||
Log.i("GeckoApp", "create");
|
||||
Log.i(LOG_FILE_NAME, "create");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (sGREDir == null)
|
||||
@ -319,30 +321,30 @@ abstract public class GeckoApp
|
||||
return;
|
||||
|
||||
if (Intent.ACTION_MAIN.equals(action)) {
|
||||
Log.i("GeckoApp", "Intent : ACTION_MAIN");
|
||||
Log.i(LOG_FILE_NAME, "Intent : ACTION_MAIN");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
|
||||
}
|
||||
else if (Intent.ACTION_VIEW.equals(action)) {
|
||||
String uri = intent.getDataString();
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
|
||||
Log.i("GeckoApp","onNewIntent: "+uri);
|
||||
Log.i(LOG_FILE_NAME,"onNewIntent: "+uri);
|
||||
}
|
||||
else if (ACTION_WEBAPP.equals(action)) {
|
||||
String uri = intent.getStringExtra("args");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
|
||||
Log.i("GeckoApp","Intent : WEBAPP - " + uri);
|
||||
Log.i(LOG_FILE_NAME,"Intent : WEBAPP - " + uri);
|
||||
}
|
||||
else if (ACTION_BOOKMARK.equals(action)) {
|
||||
String args = intent.getStringExtra("args");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(args));
|
||||
Log.i("GeckoApp","Intent : BOOKMARK - " + args);
|
||||
Log.i(LOG_FILE_NAME,"Intent : BOOKMARK - " + args);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
Log.i("GeckoApp", "pause");
|
||||
Log.i(LOG_FILE_NAME, "pause");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
|
||||
// The user is navigating away from this activity, but nothing
|
||||
// has come to the foreground yet; for Gecko, we may want to
|
||||
@ -364,7 +366,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
Log.i("GeckoApp", "resume");
|
||||
Log.i(LOG_FILE_NAME, "resume");
|
||||
if (checkLaunchState(LaunchState.GeckoRunning))
|
||||
GeckoAppShell.onResume();
|
||||
// After an onPause, the activity is back in the foreground.
|
||||
@ -389,7 +391,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
Log.i("GeckoApp", "stop");
|
||||
Log.i(LOG_FILE_NAME, "stop");
|
||||
// We're about to be stopped, potentially in preparation for
|
||||
// being destroyed. We're killable after this point -- as I
|
||||
// understand it, in extreme cases the process can be terminated
|
||||
@ -410,7 +412,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onRestart()
|
||||
{
|
||||
Log.i("GeckoApp", "restart");
|
||||
Log.i(LOG_FILE_NAME, "restart");
|
||||
GeckoAppShell.putChildInForeground();
|
||||
super.onRestart();
|
||||
}
|
||||
@ -418,14 +420,14 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
Log.i("GeckoApp", "start");
|
||||
Log.i(LOG_FILE_NAME, "start");
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
Log.i("GeckoApp", "destroy");
|
||||
Log.i(LOG_FILE_NAME, "destroy");
|
||||
// Tell Gecko to shutting down; we'll end up calling System.exit()
|
||||
// in onXreExit.
|
||||
if (isFinishing())
|
||||
@ -437,7 +439,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onConfigurationChanged(android.content.res.Configuration newConfig)
|
||||
{
|
||||
Log.i("GeckoApp", "configuration changed");
|
||||
Log.i(LOG_FILE_NAME, "configuration changed");
|
||||
// nothing, just ignore
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
@ -445,7 +447,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onLowMemory()
|
||||
{
|
||||
Log.e("GeckoApp", "low memory");
|
||||
Log.e(LOG_FILE_NAME, "low memory");
|
||||
if (checkLaunchState(LaunchState.GeckoRunning))
|
||||
GeckoAppShell.onLowMemory();
|
||||
super.onLowMemory();
|
||||
@ -470,7 +472,7 @@ abstract public class GeckoApp
|
||||
removeFiles();
|
||||
} catch (Exception ex) {
|
||||
// This file may not be there, so just log any errors and move on
|
||||
Log.w("GeckoApp", "error removing files", ex);
|
||||
Log.w(LOG_FILE_NAME, "error removing files", ex);
|
||||
}
|
||||
unpackFile(zip, buf, null, "application.ini");
|
||||
unpackFile(zip, buf, null, getContentProcessName());
|
||||
@ -585,11 +587,11 @@ abstract public class GeckoApp
|
||||
addEnvToIntent(intent);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
Log.i("GeckoAppJava", intent.toString());
|
||||
Log.i(LOG_FILE_NAME, intent.toString());
|
||||
GeckoAppShell.killAnyZombies();
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.i("GeckoAppJava", "error doing restart", e);
|
||||
Log.i(LOG_FILE_NAME, "error doing restart", e);
|
||||
}
|
||||
finish();
|
||||
// Give the restart process time to start before we die
|
||||
@ -601,7 +603,7 @@ abstract public class GeckoApp
|
||||
}
|
||||
|
||||
private void checkAndLaunchUpdate() {
|
||||
Log.i("GeckoAppJava", "Checking for an update");
|
||||
Log.i(LOG_FILE_NAME, "Checking for an update");
|
||||
|
||||
int statusCode = 8; // UNEXPECTED_ERROR
|
||||
File baseUpdateDir = null;
|
||||
@ -621,7 +623,7 @@ abstract public class GeckoApp
|
||||
if (!updateFile.exists())
|
||||
return;
|
||||
|
||||
Log.i("GeckoAppJava", "Update is available!");
|
||||
Log.i(LOG_FILE_NAME, "Update is available!");
|
||||
|
||||
// Launch APK
|
||||
File updateFileToRun = new File(updateDir, getPackageName() + "-update.apk");
|
||||
@ -630,15 +632,15 @@ abstract public class GeckoApp
|
||||
String amCmd = "/system/bin/am start -a android.intent.action.VIEW " +
|
||||
"-n com.android.packageinstaller/.PackageInstallerActivity -d file://" +
|
||||
updateFileToRun.getPath();
|
||||
Log.i("GeckoAppJava", amCmd);
|
||||
Log.i(LOG_FILE_NAME, amCmd);
|
||||
Runtime.getRuntime().exec(amCmd);
|
||||
statusCode = 0; // OK
|
||||
} else {
|
||||
Log.i("GeckoAppJava", "Cannot rename the update file!");
|
||||
Log.i(LOG_FILE_NAME, "Cannot rename the update file!");
|
||||
statusCode = 7; // WRITE_ERROR
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.i("GeckoAppJava", "error launching installer to update", e);
|
||||
Log.i(LOG_FILE_NAME, "error launching installer to update", e);
|
||||
}
|
||||
|
||||
// Update the status file
|
||||
@ -651,7 +653,7 @@ abstract public class GeckoApp
|
||||
outStream.write(buf, 0, buf.length);
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
Log.i("GeckoAppJava", "error writing status file", e);
|
||||
Log.i(LOG_FILE_NAME, "error writing status file", e);
|
||||
}
|
||||
|
||||
if (statusCode == 0)
|
||||
@ -665,7 +667,7 @@ abstract public class GeckoApp
|
||||
status = reader.readLine();
|
||||
reader.close();
|
||||
} catch (Exception e) {
|
||||
Log.i("GeckoAppJava", "error reading update status", e);
|
||||
Log.i(LOG_FILE_NAME, "error reading update status", e);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@ -682,10 +684,14 @@ abstract public class GeckoApp
|
||||
Intent.createChooser(intent, getString(R.string.choose_file)),
|
||||
FILE_PICKER_REQUEST);
|
||||
String filePickerResult = "";
|
||||
|
||||
try {
|
||||
filePickerResult = mFilePickerResult.take();
|
||||
while (null == (filePickerResult = mFilePickerResult.poll(1, TimeUnit.MILLISECONDS))) {
|
||||
Log.i("GeckoApp", "processing events from showFilePicker ");
|
||||
GeckoAppShell.processNextNativeEvent();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Log.i("GeckoApp", "showing file picker ", e);
|
||||
Log.i(LOG_FILE_NAME, "showing file picker ", e);
|
||||
}
|
||||
|
||||
return filePickerResult;
|
||||
@ -738,13 +744,13 @@ abstract public class GeckoApp
|
||||
fos.close();
|
||||
filePickerResult = file.getAbsolutePath();
|
||||
}catch (Exception e) {
|
||||
Log.e("GeckoApp", "showing file picker", e);
|
||||
Log.e(LOG_FILE_NAME, "showing file picker", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
mFilePickerResult.put(filePickerResult);
|
||||
} catch (InterruptedException e) {
|
||||
Log.i("GeckoApp", "error returning file picker result", e);
|
||||
Log.i(LOG_FILE_NAME, "error returning file picker result", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ import android.graphics.Bitmap;
|
||||
|
||||
public class GeckoAppShell
|
||||
{
|
||||
private static final String LOG_FILE_NAME = "GeckoAppShell";
|
||||
|
||||
// static members only
|
||||
private GeckoAppShell() { }
|
||||
|
||||
@ -117,6 +119,8 @@ public class GeckoAppShell
|
||||
public static native void onChangeNetworkLinkStatus(String status, String type);
|
||||
public static native void reportJavaCrash(String stack);
|
||||
|
||||
public static native void processNextNativeEvent();
|
||||
|
||||
// A looper thread, accessed by GeckoAppShell.getHandler
|
||||
private static class LooperThread extends Thread {
|
||||
public SynchronousQueue<Handler> mHandlerQueue =
|
||||
@ -190,25 +194,25 @@ public class GeckoAppShell
|
||||
sFreeSpace = cacheStats.getFreeBlocks() *
|
||||
cacheStats.getBlockSize();
|
||||
} else {
|
||||
Log.i("GeckoAppShell", "Unable to get cache dir");
|
||||
Log.i(LOG_FILE_NAME, "Unable to get cache dir");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("GeckoAppShell", "exception while stating cache dir: ", e);
|
||||
Log.e(LOG_FILE_NAME, "exception while stating cache dir: ", e);
|
||||
}
|
||||
return sFreeSpace;
|
||||
}
|
||||
|
||||
static boolean moveFile(File inFile, File outFile)
|
||||
{
|
||||
Log.i("GeckoAppShell", "moving " + inFile + " to " + outFile);
|
||||
Log.i(LOG_FILE_NAME, "moving " + inFile + " to " + outFile);
|
||||
if (outFile.isDirectory())
|
||||
outFile = new File(outFile, inFile.getName());
|
||||
try {
|
||||
if (inFile.renameTo(outFile))
|
||||
return true;
|
||||
} catch (SecurityException se) {
|
||||
Log.w("GeckoAppShell", "error trying to rename file", se);
|
||||
Log.w(LOG_FILE_NAME, "error trying to rename file", se);
|
||||
}
|
||||
try {
|
||||
long lastModified = inFile.lastModified();
|
||||
@ -227,11 +231,11 @@ public class GeckoAppShell
|
||||
else
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
Log.e("GeckoAppShell", "exception while moving file: ", e);
|
||||
Log.e(LOG_FILE_NAME, "exception while moving file: ", e);
|
||||
try {
|
||||
outFile.delete();
|
||||
} catch (SecurityException se) {
|
||||
Log.w("GeckoAppShell", "error trying to delete file", se);
|
||||
Log.w(LOG_FILE_NAME, "error trying to delete file", se);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -244,7 +248,7 @@ public class GeckoAppShell
|
||||
if (from.renameTo(to))
|
||||
return true;
|
||||
} catch (SecurityException se) {
|
||||
Log.w("GeckoAppShell", "error trying to rename file", se);
|
||||
Log.w(LOG_FILE_NAME, "error trying to rename file", se);
|
||||
}
|
||||
File[] files = from.listFiles();
|
||||
boolean retVal = true;
|
||||
@ -262,7 +266,7 @@ public class GeckoAppShell
|
||||
}
|
||||
from.delete();
|
||||
} catch(Exception e) {
|
||||
Log.e("GeckoAppShell", "error trying to move file", e);
|
||||
Log.e(LOG_FILE_NAME, "error trying to move file", e);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
@ -310,11 +314,11 @@ public class GeckoAppShell
|
||||
GeckoAppShell.putenv("GRE_HOME=" + GeckoApp.sGREDir.getPath());
|
||||
Intent i = geckoApp.getIntent();
|
||||
String env = i.getStringExtra("env0");
|
||||
Log.i("GeckoApp", "env0: "+ env);
|
||||
Log.i(LOG_FILE_NAME, "env0: "+ env);
|
||||
for (int c = 1; env != null; c++) {
|
||||
GeckoAppShell.putenv(env);
|
||||
env = i.getStringExtra("env" + c);
|
||||
Log.i("GeckoApp", "env"+ c +": "+ env);
|
||||
Log.i(LOG_FILE_NAME, "env"+ c +": "+ env);
|
||||
}
|
||||
|
||||
File f = geckoApp.getDir("tmp", Context.MODE_WORLD_READABLE |
|
||||
@ -346,7 +350,7 @@ public class GeckoAppShell
|
||||
GeckoAppShell.putenv("UPDATES_DIRECTORY=" + updatesDir.getPath());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("GeckoApp", "No download directory has been found: " + e);
|
||||
Log.i(LOG_FILE_NAME, "No download directory has been found: " + e);
|
||||
}
|
||||
|
||||
putLocaleEnv();
|
||||
@ -1107,7 +1111,7 @@ public class GeckoAppShell
|
||||
|
||||
// If the network state has changed, notify Gecko
|
||||
if (notifyChanged && (state != sNetworkState || typeCode != sNetworkTypeCode)) {
|
||||
Log.i("GeckoAppShell", "Network state changed: (" + state + ", " + type + ") ");
|
||||
Log.i(LOG_FILE_NAME, "Network state changed: (" + state + ", " + type + ") ");
|
||||
sNetworkState = state;
|
||||
sNetworkType = type;
|
||||
sNetworkTypeCode = typeCode;
|
||||
@ -1191,7 +1195,7 @@ public class GeckoAppShell
|
||||
fos.write(new Integer(pid).toString().getBytes());
|
||||
fos.close();
|
||||
} catch(Exception e) {
|
||||
Log.e("GeckoAppShell", "error putting child in the background", e);
|
||||
Log.e(LOG_FILE_NAME, "error putting child in the background", e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -1212,7 +1216,7 @@ public class GeckoAppShell
|
||||
fos.write(new Integer(pid).toString().getBytes());
|
||||
fos.close();
|
||||
} catch(Exception e) {
|
||||
Log.e("GeckoAppShell", "error putting child in the foreground", e);
|
||||
Log.e(LOG_FILE_NAME, "error putting child in the foreground", e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -1300,7 +1304,7 @@ public class GeckoAppShell
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("GeckoAppShell", "finding procs throws ", e);
|
||||
Log.i(LOG_FILE_NAME, "finding procs throws ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,7 +1347,7 @@ public class GeckoAppShell
|
||||
return buf.array();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("GeckoAppShell", "getIconForExtension error: ", e);
|
||||
Log.i(LOG_FILE_NAME, "getIconForExtension error: ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ class GeckoSurfaceView
|
||||
extends SurfaceView
|
||||
implements SurfaceHolder.Callback, SensorEventListener, LocationListener
|
||||
{
|
||||
private static final String LOG_FILE_NAME = "GeckoSurfaceView";
|
||||
|
||||
public GeckoSurfaceView(Context context) {
|
||||
super(context);
|
||||
|
||||
@ -107,7 +109,7 @@ class GeckoSurfaceView
|
||||
void drawSplashScreen(SurfaceHolder holder, int width, int height) {
|
||||
Canvas c = holder.lockCanvas();
|
||||
if (c == null) {
|
||||
Log.i("GeckoSurfaceView", "canvas is null");
|
||||
Log.i(LOG_FILE_NAME, "canvas is null");
|
||||
return;
|
||||
}
|
||||
Resources res = getResources();
|
||||
@ -173,7 +175,7 @@ class GeckoSurfaceView
|
||||
|
||||
try {
|
||||
if (mInDrawing) {
|
||||
Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!");
|
||||
Log.w(LOG_FILE_NAME, "surfaceChanged while mInDrawing is true!");
|
||||
}
|
||||
|
||||
boolean invalidSize;
|
||||
@ -198,7 +200,7 @@ class GeckoSurfaceView
|
||||
mHeight = height;
|
||||
mSurfaceValid = true;
|
||||
|
||||
Log.i("GeckoAppJava", "surfaceChanged: fmt: " + format + " dim: " + width + " " + height);
|
||||
Log.i(LOG_FILE_NAME, "surfaceChanged: fmt: " + format + " dim: " + width + " " + height);
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
@ -225,7 +227,7 @@ class GeckoSurfaceView
|
||||
try {
|
||||
syncDrawObject = mSyncDraws.take();
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie);
|
||||
Log.e(LOG_FILE_NAME, "Threw exception while getting sync draw bitmap/buffer: ", ie);
|
||||
}
|
||||
if (syncDrawObject != null) {
|
||||
if (syncDrawObject instanceof Bitmap)
|
||||
@ -238,7 +240,7 @@ class GeckoSurfaceView
|
||||
}
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
Log.i("GeckoAppJava", "surface created");
|
||||
Log.i(LOG_FILE_NAME, "surface created");
|
||||
GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_CREATED);
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
if (mShowingSplashScreen)
|
||||
@ -246,7 +248,7 @@ class GeckoSurfaceView
|
||||
}
|
||||
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
Log.i("GeckoAppJava", "surface destroyed");
|
||||
Log.i(LOG_FILE_NAME, "surface destroyed");
|
||||
mSurfaceValid = false;
|
||||
mSoftwareBuffer = null;
|
||||
mSoftwareBufferCopy = null;
|
||||
@ -294,7 +296,7 @@ class GeckoSurfaceView
|
||||
|
||||
public int beginDrawing() {
|
||||
if (mInDrawing) {
|
||||
Log.e("GeckoAppJava", "Recursive beginDrawing call!");
|
||||
Log.e(LOG_FILE_NAME, "Recursive beginDrawing call!");
|
||||
return DRAW_ERROR;
|
||||
}
|
||||
|
||||
@ -312,7 +314,7 @@ class GeckoSurfaceView
|
||||
mSurfaceLock.lock();
|
||||
|
||||
if (!mSurfaceValid) {
|
||||
Log.e("GeckoAppJava", "Surface not valid");
|
||||
Log.e(LOG_FILE_NAME, "Surface not valid");
|
||||
mSurfaceLock.unlock();
|
||||
return DRAW_ERROR;
|
||||
}
|
||||
@ -324,20 +326,20 @@ class GeckoSurfaceView
|
||||
|
||||
public void endDrawing() {
|
||||
if (!mInDrawing) {
|
||||
Log.e("GeckoAppJava", "endDrawing without beginDrawing!");
|
||||
Log.e(LOG_FILE_NAME, "endDrawing without beginDrawing!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!mSurfaceValid) {
|
||||
Log.e("GeckoAppJava", "endDrawing with false mSurfaceValid");
|
||||
Log.e(LOG_FILE_NAME, "endDrawing with false mSurfaceValid");
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
mInDrawing = false;
|
||||
|
||||
if (!mSurfaceLock.isHeldByCurrentThread())
|
||||
Log.e("GeckoAppJava", "endDrawing while mSurfaceLock not held by current thread!");
|
||||
Log.e(LOG_FILE_NAME, "endDrawing while mSurfaceLock not held by current thread!");
|
||||
|
||||
mSurfaceLock.unlock();
|
||||
}
|
||||
@ -368,7 +370,7 @@ class GeckoSurfaceView
|
||||
try {
|
||||
mSyncDraws.put(bitmap);
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e("GeckoAppJava", "Threw exception while getting sync draws queue: ", ie);
|
||||
Log.e(LOG_FILE_NAME, "Threw exception while getting sync draws queue: ", ie);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -389,7 +391,7 @@ class GeckoSurfaceView
|
||||
try {
|
||||
mSyncDraws.put(buffer);
|
||||
} catch (InterruptedException ie) {
|
||||
Log.e("GeckoAppJava", "Threw exception while getting sync bitmaps queue: ", ie);
|
||||
Log.e(LOG_FILE_NAME, "Threw exception while getting sync bitmaps queue: ", ie);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -492,7 +494,7 @@ class GeckoSurfaceView
|
||||
mLastGeoAddress = addresses.get(0);
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(location[0], mLastGeoAddress));
|
||||
} catch (Exception e) {
|
||||
Log.w("GeckoSurfaceView", "GeocoderTask "+e);
|
||||
Log.w(LOG_FILE_NAME, "GeocoderTask "+e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -887,15 +887,13 @@ nsDocShellTreeOwner::AddChromeListeners()
|
||||
GetDOMEventTarget(mWebBrowser, getter_AddRefs(target));
|
||||
|
||||
nsEventListenerManager* elmP = target->GetListenerManager(PR_TRUE);
|
||||
if (elmP)
|
||||
{
|
||||
rv = elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
if (elmP) {
|
||||
elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
// These accessors will never return null.
|
||||
gfxContext *ThebesContext() { return mThebes; }
|
||||
nsDeviceContext *DeviceContext() { return mDeviceContext; }
|
||||
PRUint32 AppUnitsPerDevPixel() { return mP2A; }
|
||||
PRUint32 AppUnitsPerDevPixel() { return NSToIntRound(mP2A); }
|
||||
|
||||
// Graphics state
|
||||
|
||||
|
@ -2012,6 +2012,8 @@ case "$target" in
|
||||
# logging code in nsObjCExceptions.h. Currently we only use that in debug
|
||||
# builds.
|
||||
MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
|
||||
if test "x$lto_is_enabled" = "xyes"; then
|
||||
echo "Skipping -dead_strip because lto is enabled."
|
||||
@ -2160,6 +2162,8 @@ ia64*-hpux*)
|
||||
fi
|
||||
# The Maemo builders don't know about this flag
|
||||
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
;;
|
||||
|
||||
*-*linux*)
|
||||
@ -2185,7 +2189,8 @@ ia64*-hpux*)
|
||||
fi
|
||||
MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
|
||||
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
|
||||
MOZ_DEBUG_FLAGS="-g"
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS="-g -fno-omit-frame-pointer"
|
||||
fi
|
||||
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
|
||||
@ -2301,7 +2306,8 @@ ia64*-hpux*)
|
||||
CFLAGS="$CFLAGS -we4553"
|
||||
CXXFLAGS="$CXXFLAGS -we4553"
|
||||
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
|
||||
MOZ_DEBUG_FLAGS='-Zi'
|
||||
# Debug builds should always have frame pointers
|
||||
MOZ_DEBUG_FLAGS='-Zi -Oy-'
|
||||
MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
|
||||
WARNINGS_AS_ERRORS='-WX'
|
||||
# If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
|
||||
@ -3494,53 +3500,6 @@ then
|
||||
LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl See if mmap sees writes
|
||||
dnl For cross compiling, just define it as no, which is a safe default
|
||||
dnl ========================================================
|
||||
AC_MSG_CHECKING(whether mmap() sees write()s)
|
||||
|
||||
changequote(,)
|
||||
mmap_test_prog='
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
char fname[] = "conftest.file";
|
||||
char zbuff[1024]; /* Fractional page is probably worst case */
|
||||
|
||||
int main() {
|
||||
char *map;
|
||||
int fd;
|
||||
int i;
|
||||
unlink(fname);
|
||||
fd = open(fname, O_RDWR | O_CREAT, 0660);
|
||||
if(fd<0) return 1;
|
||||
unlink(fname);
|
||||
write(fd, zbuff, sizeof(zbuff));
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
|
||||
if(map==(char*)-1) return 2;
|
||||
for(i=0; fname[i]; i++) {
|
||||
int rc = write(fd, &fname[i], 1);
|
||||
if(map[i]!=fname[i]) return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
'
|
||||
changequote([,])
|
||||
|
||||
AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
|
||||
|
||||
AC_MSG_RESULT("$result")
|
||||
|
||||
if test "$result" = "no"; then
|
||||
AC_DEFINE(MMAP_MISSES_WRITES)
|
||||
fi
|
||||
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl ========================================================
|
||||
|
5
js/src/jit-test/tests/basic/testBug677367.js
Normal file
5
js/src/jit-test/tests/basic/testBug677367.js
Normal file
@ -0,0 +1,5 @@
|
||||
// |jit-test| debug
|
||||
|
||||
function f() {}
|
||||
trap(f, 0, 'eval("2+2")');
|
||||
f();
|
@ -0,0 +1,32 @@
|
||||
var finalizerRun = false;
|
||||
var caught = false;
|
||||
|
||||
function foo(arr) {
|
||||
finalizerRun = true;
|
||||
return not_defined;
|
||||
}
|
||||
|
||||
function gen() {
|
||||
try {
|
||||
yield 1;
|
||||
} finally {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
var i_have_locals;
|
||||
for (i in gen()) {
|
||||
"this won't work"();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
test();
|
||||
} catch(e) {
|
||||
caught = true;
|
||||
assertEq(''+e, "ReferenceError: not_defined is not defined");
|
||||
}
|
||||
|
||||
assertEq(finalizerRun, true);
|
||||
assertEq(caught, true);
|
4
js/src/jit-test/tests/basic/testEvalFromTrap.js
Normal file
4
js/src/jit-test/tests/basic/testEvalFromTrap.js
Normal file
@ -0,0 +1,4 @@
|
||||
// |jit-test| debug
|
||||
function f() {}
|
||||
trap(f, 0, 'eval("2+2")');
|
||||
f();
|
@ -128,6 +128,12 @@ var obj = { valueOf:(function valueOf() {
|
||||
|
||||
/***********/
|
||||
|
||||
var proxy = Proxy.createFunction({}, function f() { assertStackIs([f, "global-code"]) });
|
||||
proxy();
|
||||
new proxy();
|
||||
|
||||
/***********/
|
||||
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
/* No loss for scripts. */
|
||||
(function f() {
|
||||
|
@ -0,0 +1,16 @@
|
||||
// Don't crash when a scripted proxy handler throws Error.prototype.
|
||||
|
||||
var g = newGlobal('new-compartment');
|
||||
var dbg = Debugger(g);
|
||||
dbg.onDebuggerStatement = function (frame) {
|
||||
try {
|
||||
frame.arguments[0].deleteProperty("x");
|
||||
} catch (exc) {
|
||||
return;
|
||||
}
|
||||
throw new Error("deleteProperty should throw");
|
||||
};
|
||||
|
||||
g.eval("function h(x) { debugger; }");
|
||||
g.eval("h(Proxy.create({delete: function () { throw Error.prototype; }}));");
|
||||
|
10
js/src/jit-test/tests/debug/onDebuggerStatement-04.js
Normal file
10
js/src/jit-test/tests/debug/onDebuggerStatement-04.js
Normal file
@ -0,0 +1,10 @@
|
||||
var g = newGlobal('new-compartment');
|
||||
var dbg = new Debugger(g);
|
||||
dbg.onDebuggerStatement = function (frame) {
|
||||
var code = "assertEq(c, 'ok');\n";
|
||||
assertEq(frame.evalWithBindings("eval(s)", {s: code, a: 1234}).return, undefined);
|
||||
};
|
||||
g.eval("function first() { return second(); }");
|
||||
g.eval("function second() { return eval('third()'); }");
|
||||
g.eval("function third() { debugger; }");
|
||||
g.evaluate("first();");
|
@ -26,7 +26,7 @@ BEGIN_TEST(testLookup_bug522590)
|
||||
JSObject *funobj = JSVAL_TO_OBJECT(r);
|
||||
CHECK(funobj->isFunction());
|
||||
CHECK(!js::IsInternalFunctionObject(funobj));
|
||||
CHECK(GET_FUNCTION_PRIVATE(cx, funobj) != (JSFunction *) funobj);
|
||||
CHECK(funobj->getFunctionPrivate() != (JSFunction *) funobj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ JS_ConvertArgumentsVA(JSContext *cx, uintN argc, jsval *argv, const char *format
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
*sp = OBJECT_TO_JSVAL(obj);
|
||||
*va_arg(ap, JSFunction **) = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
*va_arg(ap, JSFunction **) = obj->getFunctionPrivate();
|
||||
break;
|
||||
case 'v':
|
||||
*va_arg(ap, jsval *) = *sp;
|
||||
@ -2270,10 +2270,10 @@ JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, ui
|
||||
JSObject *obj = (JSObject *)thing;
|
||||
Class *clasp = obj->getClass();
|
||||
if (clasp == &js_FunctionClass) {
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(trc->context, obj);
|
||||
JSFunction *fun = obj->getFunctionPrivate();
|
||||
if (!fun) {
|
||||
JS_snprintf(buf, bufsize, "<newborn>");
|
||||
} else if (FUN_OBJECT(fun) != obj) {
|
||||
} else if (fun != obj) {
|
||||
JS_snprintf(buf, bufsize, "%p", fun);
|
||||
} else {
|
||||
if (fun->atom)
|
||||
@ -4208,8 +4208,8 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
if (!FUN_FLAT_CLOSURE(fun))
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
if (!fun->isFlatClosure())
|
||||
return CloneFunctionObject(cx, fun, parent);
|
||||
|
||||
/*
|
||||
@ -4254,7 +4254,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_GetFunctionObject(JSFunction *fun)
|
||||
{
|
||||
return FUN_OBJECT(fun);
|
||||
return fun;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -4357,7 +4357,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs)
|
||||
* as fun->object lives.
|
||||
*/
|
||||
Value priv = PrivateValue(fs);
|
||||
if (!js_SetReservedSlot(cx, FUN_OBJECT(fun), 0, priv))
|
||||
if (!js_SetReservedSlot(cx, fun, 0, priv))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@ -4712,24 +4712,21 @@ CompileUCFunctionForPrincipalsCommon(JSContext *cx, JSObject *obj,
|
||||
funAtom = js_Atomize(cx, name, strlen(name));
|
||||
if (!funAtom) {
|
||||
fun = NULL;
|
||||
goto out2;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
fun = js_NewFunction(cx, NULL, NULL, 0, JSFUN_INTERPRETED, obj, funAtom);
|
||||
if (!fun)
|
||||
goto out2;
|
||||
goto out;
|
||||
|
||||
{
|
||||
EmptyShape *emptyCallShape = EmptyShape::getEmptyCallShape(cx);
|
||||
if (!emptyCallShape) {
|
||||
if (!emptyCallShape)
|
||||
fun = NULL;
|
||||
goto out2;
|
||||
}
|
||||
AutoShapeRooter shapeRoot(cx, emptyCallShape);
|
||||
|
||||
AutoObjectRooter tvr(cx, FUN_OBJECT(fun));
|
||||
MUST_FLOW_THROUGH("out");
|
||||
AutoObjectRooter tvr(cx, fun);
|
||||
|
||||
Bindings bindings(cx, emptyCallShape);
|
||||
AutoBindingsRooter root(cx, bindings);
|
||||
@ -4737,20 +4734,20 @@ CompileUCFunctionForPrincipalsCommon(JSContext *cx, JSObject *obj,
|
||||
argAtom = js_Atomize(cx, argnames[i], strlen(argnames[i]));
|
||||
if (!argAtom) {
|
||||
fun = NULL;
|
||||
goto out2;
|
||||
goto out;
|
||||
}
|
||||
|
||||
uint16 dummy;
|
||||
if (!bindings.addArgument(cx, argAtom, &dummy)) {
|
||||
fun = NULL;
|
||||
goto out2;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Compiler::compileFunctionBody(cx, fun, principals, &bindings,
|
||||
chars, length, filename, lineno, version)) {
|
||||
fun = NULL;
|
||||
goto out2;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (obj && funAtom &&
|
||||
@ -4760,10 +4757,11 @@ CompileUCFunctionForPrincipalsCommon(JSContext *cx, JSObject *obj,
|
||||
}
|
||||
}
|
||||
|
||||
out2:
|
||||
out:
|
||||
LAST_FRAME_CHECKS(cx, fun);
|
||||
return fun;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSFunction *)
|
||||
JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals, const char *name,
|
||||
@ -4892,7 +4890,7 @@ JS_ExecuteScript(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval)
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, scriptObj);
|
||||
|
||||
JSBool ok = ExternalExecute(cx, scriptObj->getScript(), *obj, Valueify(rval));
|
||||
JSBool ok = Execute(cx, scriptObj->getScript(), *obj, Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
return ok;
|
||||
}
|
||||
@ -4926,7 +4924,7 @@ EvaluateUCScriptForPrincipalsCommon(JSContext *cx, JSObject *obj,
|
||||
}
|
||||
JS_ASSERT(script->getVersion() == compileVersion);
|
||||
|
||||
bool ok = ExternalExecute(cx, script, *obj, Valueify(rval));
|
||||
bool ok = Execute(cx, script, *obj, Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
js_DestroyScript(cx, script, 5);
|
||||
return ok;
|
||||
@ -5006,8 +5004,8 @@ JS_CallFunction(JSContext *cx, JSObject *obj, JSFunction *fun, uintN argc, jsval
|
||||
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, fun, JSValueArray(argv, argc));
|
||||
JSBool ok = ExternalInvoke(cx, ObjectOrNullValue(obj), ObjectValue(*fun), argc,
|
||||
Valueify(argv), Valueify(rval));
|
||||
JSBool ok = Invoke(cx, ObjectOrNullValue(obj), ObjectValue(*fun), argc, Valueify(argv),
|
||||
Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
return ok;
|
||||
}
|
||||
@ -5025,8 +5023,7 @@ JS_CallFunctionName(JSContext *cx, JSObject *obj, const char *name, uintN argc,
|
||||
JSBool ok =
|
||||
atom &&
|
||||
js_GetMethod(cx, obj, ATOM_TO_JSID(atom), JSGET_NO_METHOD_BARRIER, tvr.addr()) &&
|
||||
ExternalInvoke(cx, ObjectOrNullValue(obj), tvr.value(), argc, Valueify(argv),
|
||||
Valueify(rval));
|
||||
Invoke(cx, ObjectOrNullValue(obj), tvr.value(), argc, Valueify(argv), Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
return ok;
|
||||
}
|
||||
@ -5039,8 +5036,8 @@ JS_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval, uintN argc, jsval
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, fval, JSValueArray(argv, argc));
|
||||
JSBool ok = ExternalInvoke(cx, ObjectOrNullValue(obj), Valueify(fval), argc, Valueify(argv),
|
||||
Valueify(rval));
|
||||
JSBool ok = Invoke(cx, ObjectOrNullValue(obj), Valueify(fval), argc, Valueify(argv),
|
||||
Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
return ok;
|
||||
}
|
||||
@ -5054,7 +5051,7 @@ Call(JSContext *cx, jsval thisv, jsval fval, uintN argc, jsval *argv, jsval *rva
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, thisv, fval, JSValueArray(argv, argc));
|
||||
ok = ExternalInvoke(cx, Valueify(thisv), Valueify(fval), argc, Valueify(argv), Valueify(rval));
|
||||
ok = Invoke(cx, Valueify(thisv), Valueify(fval), argc, Valueify(argv), Valueify(rval));
|
||||
LAST_FRAME_CHECKS(cx, ok);
|
||||
return ok;
|
||||
}
|
||||
@ -5070,7 +5067,7 @@ JS_New(JSContext *cx, JSObject *ctor, uintN argc, jsval *argv)
|
||||
// This is not a simple variation of JS_CallFunctionValue because JSOP_NEW
|
||||
// is not a simple variation of JSOP_CALL. We have to determine what class
|
||||
// of object to create, create it, and clamp the return value to an object,
|
||||
// among other details. js_InvokeConstructor does the hard work.
|
||||
// among other details. InvokeConstructor does the hard work.
|
||||
InvokeArgsGuard args;
|
||||
if (!cx->stack.pushInvokeArgs(cx, argc, &args))
|
||||
return NULL;
|
||||
|
@ -310,7 +310,7 @@ js_NewNullClosure(JSContext* cx, JSObject* funobj, JSObject* proto, JSObject* pa
|
||||
JS_ASSERT(JS_ON_TRACE(cx));
|
||||
|
||||
JSFunction *fun = (JSFunction*) funobj;
|
||||
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, funobj) == fun);
|
||||
JS_ASSERT(funobj->getFunctionPrivate() == fun);
|
||||
|
||||
JSObject* closure = js_NewGCObject(cx, gc::FINALIZE_OBJECT2);
|
||||
if (!closure)
|
||||
|
@ -1083,7 +1083,7 @@ js_ReportMissingArg(JSContext *cx, const Value &v, uintN arg)
|
||||
JS_snprintf(argbuf, sizeof argbuf, "%u", arg);
|
||||
bytes = NULL;
|
||||
if (IsFunctionObject(v)) {
|
||||
atom = GET_FUNCTION_PRIVATE(cx, &v.toObject())->atom;
|
||||
atom = v.toObject().getFunctionPrivate()->atom;
|
||||
bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
|
||||
v, atom);
|
||||
if (!bytes)
|
||||
|
@ -349,7 +349,7 @@ CallSetter(JSContext *cx, JSObject *obj, jsid id, js::StrictPropertyOp op, uintN
|
||||
uintN shortid, JSBool strict, js::Value *vp)
|
||||
{
|
||||
if (attrs & JSPROP_SETTER)
|
||||
return ExternalGetOrSet(cx, obj, id, CastAsObjectJsval(op), JSACC_WRITE, 1, vp, vp);
|
||||
return InvokeGetterOrSetter(cx, obj, CastAsObjectJsval(op), 1, vp, vp);
|
||||
|
||||
if (attrs & JSPROP_GETTER)
|
||||
return js_ReportGetterOnlyAssignment(cx);
|
||||
|
@ -548,7 +548,7 @@ JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
|
||||
{
|
||||
return FUN_SCRIPT(fun);
|
||||
return fun->maybeScript();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSNative)
|
||||
@ -1095,8 +1095,8 @@ JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun)
|
||||
size_t nbytes;
|
||||
|
||||
nbytes = sizeof *fun;
|
||||
nbytes += JS_GetObjectTotalSize(cx, FUN_OBJECT(fun));
|
||||
if (FUN_INTERPRETED(fun))
|
||||
nbytes += JS_GetObjectTotalSize(cx, fun);
|
||||
if (fun->isInterpreted())
|
||||
nbytes += JS_GetScriptTotalSize(cx, fun->script());
|
||||
if (fun->atom)
|
||||
nbytes += GetAtomTotalSize(cx, fun->atom);
|
||||
|
@ -4815,7 +4815,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
#endif
|
||||
|
||||
fun = pn->pn_funbox->function();
|
||||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
if (fun->script()) {
|
||||
/*
|
||||
* This second pass is needed to emit JSOP_NOP with a source note
|
||||
@ -4830,7 +4830,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
}
|
||||
|
||||
JS_ASSERT_IF(pn->pn_funbox->tcflags & TCF_FUN_HEAVYWEIGHT,
|
||||
FUN_KIND(fun) == JSFUN_INTERPRETED);
|
||||
fun->kind() == JSFUN_INTERPRETED);
|
||||
|
||||
/* Generate code for the function's body. */
|
||||
void *cg2mark = JS_ARENA_MARK(cg->codePool);
|
||||
@ -4913,7 +4913,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
return false;
|
||||
if (pn->pn_cookie.isFree()) {
|
||||
CG_SWITCH_TO_PROLOG(cg);
|
||||
op = FUN_FLAT_CLOSURE(fun) ? JSOP_DEFFUN_FC : JSOP_DEFFUN;
|
||||
op = fun->isFlatClosure() ? JSOP_DEFFUN_FC : JSOP_DEFFUN;
|
||||
EMIT_INDEX_OP(op, index);
|
||||
|
||||
/* Make blockChain determination quicker. */
|
||||
|
@ -528,24 +528,25 @@ js_ErrorFromException(JSContext *cx, jsval exn)
|
||||
}
|
||||
|
||||
static JSString *
|
||||
ValueToShortSource(JSContext *cx, jsval v)
|
||||
ValueToShortSource(JSContext *cx, const Value &v)
|
||||
{
|
||||
JSString *str;
|
||||
|
||||
/* Avoid toSource bloat and fallibility for object types. */
|
||||
if (JSVAL_IS_PRIMITIVE(v))
|
||||
return js_ValueToSource(cx, Valueify(v));
|
||||
if (!v.isObject())
|
||||
return js_ValueToSource(cx, v);
|
||||
|
||||
AutoCompartment ac(cx, JSVAL_TO_OBJECT(v));
|
||||
JSObject *obj = &v.toObject();
|
||||
AutoCompartment ac(cx, obj);
|
||||
if (!ac.enter())
|
||||
return NULL;
|
||||
|
||||
if (VALUE_IS_FUNCTION(cx, v)) {
|
||||
if (obj->isFunction()) {
|
||||
/*
|
||||
* XXX Avoid function decompilation bloat for now.
|
||||
*/
|
||||
str = JS_GetFunctionId(JS_ValueToFunction(cx, v));
|
||||
if (!str && !(str = js_ValueToSource(cx, Valueify(v)))) {
|
||||
str = JS_GetFunctionId(obj->getFunctionPrivate());
|
||||
if (!str && !(str = js_ValueToSource(cx, v))) {
|
||||
/*
|
||||
* Continue to soldier on if the function couldn't be
|
||||
* converted into a string.
|
||||
@ -559,8 +560,7 @@ ValueToShortSource(JSContext *cx, jsval v)
|
||||
* memory, for too many classes (see Mozilla bug 166743).
|
||||
*/
|
||||
char buf[100];
|
||||
JS_snprintf(buf, sizeof buf, "[object %s]",
|
||||
JSVAL_TO_OBJECT(v)->getClass()->name);
|
||||
JS_snprintf(buf, sizeof buf, "[object %s]", obj->getClass()->name);
|
||||
str = JS_NewStringCopyZ(cx, buf);
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ StackTraceToString(JSContext *cx, JSExnPrivate *priv)
|
||||
for (i = 0; i != elem->argc; i++, values++) {
|
||||
if (i > 0)
|
||||
APPEND_CHAR_TO_STACK(',');
|
||||
str = ValueToShortSource(cx, *values);
|
||||
str = ValueToShortSource(cx, Valueify(*values));
|
||||
if (!str)
|
||||
goto bad;
|
||||
APPEND_STRING_TO_STACK(str);
|
||||
|
@ -102,7 +102,9 @@ js_GetLocalizedErrorMessage(JSContext* cx, void *userRef, const char *locale,
|
||||
* Make a copy of errobj parented to scope.
|
||||
*
|
||||
* cx must be in the same compartment as scope. errobj may be in a different
|
||||
* compartment, but it must be an Error object (not a wrapper of one).
|
||||
* compartment, but it must be an Error object (not a wrapper of one) and it
|
||||
* must not be one of the prototype objects created by js_InitExceptionClasses
|
||||
* (errobj->getPrivate() must not be NULL).
|
||||
*/
|
||||
extern JSObject *
|
||||
js_CopyErrorObject(JSContext *cx, JSObject *errobj, JSObject *scope);
|
||||
|
@ -1251,8 +1251,9 @@ StackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
|
||||
JSObject *clone;
|
||||
|
||||
if (IsFunctionObject(v, &clone) &&
|
||||
GET_FUNCTION_PRIVATE(cx, clone) == fun &&
|
||||
clone->hasMethodObj(*thisp)) {
|
||||
clone->getFunctionPrivate() == fun &&
|
||||
clone->hasMethodObj(*thisp))
|
||||
{
|
||||
JS_ASSERT(clone != &funobj);
|
||||
*vp = v;
|
||||
overwriteCallee(*clone);
|
||||
@ -1544,8 +1545,8 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
|
||||
cx = xdr->cx;
|
||||
if (xdr->mode == JSXDR_ENCODE) {
|
||||
fun = GET_FUNCTION_PRIVATE(cx, *objp);
|
||||
if (!FUN_INTERPRETED(fun)) {
|
||||
fun = (*objp)->getFunctionPrivate();
|
||||
if (!fun->isInterpreted()) {
|
||||
JSAutoByteString funNameBytes;
|
||||
if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_SCRIPTED_FUNCTION,
|
||||
@ -1566,11 +1567,11 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
fun = js_NewFunction(cx, NULL, NULL, 0, JSFUN_INTERPRETED, NULL, NULL);
|
||||
if (!fun)
|
||||
return false;
|
||||
FUN_OBJECT(fun)->clearParent();
|
||||
FUN_OBJECT(fun)->clearProto();
|
||||
fun->clearParent();
|
||||
fun->clearProto();
|
||||
}
|
||||
|
||||
AutoObjectRooter tvr(cx, FUN_OBJECT(fun));
|
||||
AutoObjectRooter tvr(cx, fun);
|
||||
|
||||
if (!JS_XDRUint32(xdr, &firstword))
|
||||
return false;
|
||||
@ -1597,7 +1598,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
fun->u.i.script = script;
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
*objp = FUN_OBJECT(fun);
|
||||
*objp = fun;
|
||||
fun->u.i.script->setOwnerObject(fun);
|
||||
#ifdef CHECK_SCRIPT_OWNER
|
||||
fun->script()->owner = NULL;
|
||||
@ -1736,7 +1737,7 @@ fun_toStringHelper(JSContext *cx, JSObject *obj, uintN indent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSFunction *fun = obj->getFunctionPrivate();
|
||||
if (!fun)
|
||||
return NULL;
|
||||
|
||||
@ -2029,7 +2030,7 @@ fun_isGenerator(JSContext *cx, uintN argc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
|
||||
bool result = false;
|
||||
if (fun->isInterpreted()) {
|
||||
@ -2439,7 +2440,7 @@ js_NewFunction(JSContext *cx, JSObject *funobj, Native native, uintN nargs,
|
||||
fun->atom = atom;
|
||||
|
||||
/* Set private to self to indicate non-cloned fully initialized function. */
|
||||
FUN_OBJECT(fun)->setPrivate(fun);
|
||||
fun->setPrivate(fun);
|
||||
return fun;
|
||||
}
|
||||
|
||||
@ -2653,7 +2654,7 @@ js_ValueToFunction(JSContext *cx, const Value *vp, uintN flags)
|
||||
js_ReportIsNotFunction(cx, vp, flags);
|
||||
return NULL;
|
||||
}
|
||||
return GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
return funobj->getFunctionPrivate();
|
||||
}
|
||||
|
||||
JSObject *
|
||||
|
@ -60,14 +60,14 @@
|
||||
* 10 interpreted, flat closure
|
||||
* 11 interpreted, null closure
|
||||
*
|
||||
* FUN_FLAT_CLOSURE implies FUN_INTERPRETED and u.i.script->upvarsOffset != 0.
|
||||
* FUN_NULL_CLOSURE implies FUN_INTERPRETED and u.i.script->upvarsOffset == 0.
|
||||
* isFlatClosure() implies isInterpreted() and u.i.script->upvarsOffset != 0.
|
||||
* isNullClosure() implies isInterpreted() and u.i.script->upvarsOffset == 0.
|
||||
*
|
||||
* FUN_INTERPRETED but not FUN_FLAT_CLOSURE and u.i.script->upvarsOffset != 0
|
||||
* isInterpreted() but not isFlatClosure() and u.i.script->upvarsOffset != 0
|
||||
* is an Algol-like function expression or nested function, i.e., a function
|
||||
* that never escapes upward or downward (heapward), and is only ever called.
|
||||
*
|
||||
* Finally, FUN_INTERPRETED and u.i.script->upvarsOffset == 0 could be either
|
||||
* Finally, isInterpreted() and u.i.script->upvarsOffset == 0 could be either
|
||||
* a non-closure (a global function definition, or any function that uses no
|
||||
* outer names), or a closure of an escaping function that uses outer names
|
||||
* whose values can't be snapshot (because the outer names could be reassigned
|
||||
@ -80,8 +80,8 @@
|
||||
* NB: JSFUN_EXPR_CLOSURE reuses JSFUN_STUB_GSOPS, which is an API request flag
|
||||
* bit only, never stored in fun->flags.
|
||||
*
|
||||
* If we need more bits in the future, all flags for FUN_INTERPRETED functions
|
||||
* can move to u.i.script->flags. For now we use function flag bits to minimize
|
||||
* If we need more bits in the future, all flags for interpreted functions can
|
||||
* move to u.i.script->flags. For now we use function flag bits to minimize
|
||||
* pointer-chasing.
|
||||
*/
|
||||
#define JSFUN_JOINABLE 0x0001 /* function is null closure that does not
|
||||
@ -101,19 +101,6 @@
|
||||
#define JSFUN_KINDMASK 0xc000 /* encode interp vs. native and closure
|
||||
optimization level -- see above */
|
||||
|
||||
#define FUN_OBJECT(fun) (static_cast<JSObject *>(fun))
|
||||
#define FUN_KIND(fun) ((fun)->flags & JSFUN_KINDMASK)
|
||||
#define FUN_SET_KIND(fun,k) ((fun)->flags = ((fun)->flags & ~JSFUN_KINDMASK) | (k))
|
||||
#define FUN_INTERPRETED(fun) (FUN_KIND(fun) >= JSFUN_INTERPRETED)
|
||||
#define FUN_FLAT_CLOSURE(fun)(FUN_KIND(fun) == JSFUN_FLAT_CLOSURE)
|
||||
#define FUN_NULL_CLOSURE(fun)(FUN_KIND(fun) == JSFUN_NULL_CLOSURE)
|
||||
#define FUN_SCRIPT(fun) (FUN_INTERPRETED(fun) ? (fun)->script() : NULL)
|
||||
#define FUN_CLASP(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \
|
||||
fun->u.n.clasp)
|
||||
#define FUN_TRCINFO(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \
|
||||
JS_ASSERT((fun)->flags & JSFUN_TRCINFO), \
|
||||
fun->u.n.trcinfo)
|
||||
|
||||
struct JSFunction : public JSObject_Slots2
|
||||
{
|
||||
/* Functions always have two fixed slots (FUN_CLASS_RESERVED_SLOTS). */
|
||||
@ -145,16 +132,25 @@ struct JSFunction : public JSObject_Slots2
|
||||
} u;
|
||||
JSAtom *atom; /* name for diagnostics and decompiling */
|
||||
|
||||
bool optimizedClosure() const { return FUN_KIND(this) > JSFUN_INTERPRETED; }
|
||||
bool isInterpreted() const { return FUN_INTERPRETED(this); }
|
||||
bool isNative() const { return !FUN_INTERPRETED(this); }
|
||||
bool optimizedClosure() const { return kind() > JSFUN_INTERPRETED; }
|
||||
bool isInterpreted() const { return kind() >= JSFUN_INTERPRETED; }
|
||||
bool isNative() const { return !isInterpreted(); }
|
||||
bool isConstructor() const { return flags & JSFUN_CONSTRUCTOR; }
|
||||
bool isHeavyweight() const { return JSFUN_HEAVYWEIGHT_TEST(flags); }
|
||||
bool isFlatClosure() const { return FUN_KIND(this) == JSFUN_FLAT_CLOSURE; }
|
||||
bool isNullClosure() const { return kind() == JSFUN_NULL_CLOSURE; }
|
||||
bool isFlatClosure() const { return kind() == JSFUN_FLAT_CLOSURE; }
|
||||
bool isFunctionPrototype() const { return flags & JSFUN_PROTOTYPE; }
|
||||
bool isInterpretedConstructor() const { return isInterpreted() && !isFunctionPrototype(); }
|
||||
|
||||
uint16 kind() const { return flags & JSFUN_KINDMASK; }
|
||||
void setKind(uint16 k) {
|
||||
JS_ASSERT(!(k & ~JSFUN_KINDMASK));
|
||||
flags = (flags & ~JSFUN_KINDMASK) | k;
|
||||
}
|
||||
|
||||
/* Returns the strictness of this function, which must be interpreted. */
|
||||
inline bool inStrictMode() const;
|
||||
|
||||
void setArgCount(uint16 nargs) {
|
||||
JS_ASSERT(this->nargs == 0);
|
||||
this->nargs = nargs;
|
||||
@ -210,6 +206,10 @@ struct JSFunction : public JSObject_Slots2
|
||||
return u.i.script;
|
||||
}
|
||||
|
||||
JSScript * maybeScript() const {
|
||||
return isInterpreted() ? script() : NULL;
|
||||
}
|
||||
|
||||
js::Native native() const {
|
||||
JS_ASSERT(isNative());
|
||||
return u.n.native;
|
||||
@ -227,6 +227,23 @@ struct JSFunction : public JSObject_Slots2
|
||||
|
||||
/* Number of extra fixed function object slots. */
|
||||
static const uint32 CLASS_RESERVED_SLOTS = JSObject::FUN_CLASS_RESERVED_SLOTS;
|
||||
|
||||
|
||||
js::Class *getConstructorClass() const {
|
||||
JS_ASSERT(isNative());
|
||||
return u.n.clasp;
|
||||
}
|
||||
|
||||
void setConstructorClass(js::Class *clasp) {
|
||||
JS_ASSERT(isNative());
|
||||
u.n.clasp = clasp;
|
||||
}
|
||||
|
||||
JSNativeTraceInfo *getTraceInfo() const {
|
||||
JS_ASSERT(isNative());
|
||||
JS_ASSERT(flags & JSFUN_TRCINFO);
|
||||
return u.n.trcinfo;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@ -269,12 +286,6 @@ JSObject::getFunctionPrivate() const
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* NB: jsapi.h and jsobj.h must be included before any call to this macro.
|
||||
*/
|
||||
#define VALUE_IS_FUNCTION(cx, v) \
|
||||
(!JSVAL_IS_PRIMITIVE(v) && JSVAL_TO_OBJECT(v)->isFunction())
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
IsFunctionObject(const js::Value &v)
|
||||
{
|
||||
@ -354,14 +365,6 @@ SameTraceType(const Value &lhs, const Value &rhs)
|
||||
lhs.toObject().isFunction() == rhs.toObject().isFunction());
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro to access the private slot of the function object after the slot is
|
||||
* initialized.
|
||||
*/
|
||||
#define GET_FUNCTION_PRIVATE(cx, funobj) \
|
||||
(JS_ASSERT((funobj)->isFunction()), \
|
||||
(JSFunction *) (funobj)->getPrivate())
|
||||
|
||||
/*
|
||||
* Return true if this is a compiler-created internal function accessed by
|
||||
* its own object. Such a function object must not be accessible to script
|
||||
|
@ -52,7 +52,7 @@ JSFunction::inStrictMode() const
|
||||
inline void
|
||||
JSFunction::setJoinable()
|
||||
{
|
||||
JS_ASSERT(FUN_INTERPRETED(this));
|
||||
JS_ASSERT(isInterpreted());
|
||||
setSlot(METHOD_ATOM_SLOT, js::NullValue());
|
||||
flags |= JSFUN_JOINABLE;
|
||||
}
|
||||
|
@ -298,7 +298,8 @@ class HashTable : private AllocPolicy
|
||||
|
||||
static const unsigned sMinSizeLog2 = 4;
|
||||
static const unsigned sMinSize = 1 << sMinSizeLog2;
|
||||
static const unsigned sSizeLimit = JS_BIT(24);
|
||||
static const unsigned sMaxInit = JS_BIT(23);
|
||||
static const unsigned sMaxCapacity = JS_BIT(24);
|
||||
static const unsigned sHashBits = tl::BitSize<HashNumber>::result;
|
||||
static const uint8 sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */
|
||||
static const uint8 sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */
|
||||
@ -308,6 +309,14 @@ class HashTable : private AllocPolicy
|
||||
static const HashNumber sRemovedKey = Entry::sRemovedKey;
|
||||
static const HashNumber sCollisionBit = Entry::sCollisionBit;
|
||||
|
||||
static void staticAsserts()
|
||||
{
|
||||
/* Rely on compiler "constant overflow warnings". */
|
||||
JS_STATIC_ASSERT(((sMaxInit * sInvMaxAlpha) >> 7) < sMaxCapacity);
|
||||
JS_STATIC_ASSERT((sMaxCapacity * sInvMaxAlpha) <= UINT32_MAX);
|
||||
JS_STATIC_ASSERT((sMaxCapacity * sizeof(Entry)) <= UINT32_MAX);
|
||||
}
|
||||
|
||||
static bool isLiveHash(HashNumber hash)
|
||||
{
|
||||
return Entry::isLiveHash(hash);
|
||||
@ -365,7 +374,10 @@ class HashTable : private AllocPolicy
|
||||
* Correct for sMaxAlphaFrac such that the table will not resize
|
||||
* when adding 'length' entries.
|
||||
*/
|
||||
JS_ASSERT(length < (uint32(1) << 23));
|
||||
if (length > sMaxInit) {
|
||||
this->reportAllocOverflow();
|
||||
return false;
|
||||
}
|
||||
uint32 capacity = (length * sInvMaxAlpha) >> 7;
|
||||
|
||||
if (capacity < sMinSize)
|
||||
@ -379,10 +391,7 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
|
||||
capacity = roundUp;
|
||||
if (capacity >= sSizeLimit) {
|
||||
this->reportAllocOverflow();
|
||||
return false;
|
||||
}
|
||||
JS_ASSERT(capacity <= sMaxCapacity);
|
||||
|
||||
table = createTable(*this, capacity);
|
||||
if (!table)
|
||||
@ -536,7 +545,7 @@ class HashTable : private AllocPolicy
|
||||
uint32 oldCap = tableCapacity;
|
||||
uint32 newLog2 = sHashBits - hashShift + deltaLog2;
|
||||
uint32 newCapacity = JS_BIT(newLog2);
|
||||
if (newCapacity >= sSizeLimit) {
|
||||
if (newCapacity > sMaxCapacity) {
|
||||
this->reportAllocOverflow();
|
||||
return false;
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ Class js_NoSuchMethodClass = {
|
||||
* the base object, we search for the __noSuchMethod__ method in the base.
|
||||
* If it exists, we store the method and the property's id into an object of
|
||||
* NoSuchMethod class and store this object into the callee's stack slot.
|
||||
* Later, js_Invoke will recognise such an object and transfer control to
|
||||
* Later, Invoke will recognise such an object and transfer control to
|
||||
* NoSuchMethod that invokes the method like:
|
||||
*
|
||||
* this.__noSuchMethod__(id, args)
|
||||
@ -621,7 +621,7 @@ RunScript(JSContext *cx, JSScript *script, StackFrame *fp)
|
||||
* when done. Then push the return value.
|
||||
*/
|
||||
JS_REQUIRES_STACK bool
|
||||
Invoke(JSContext *cx, const CallArgs &argsRef, MaybeConstruct construct)
|
||||
InvokeKernel(JSContext *cx, const CallArgs &argsRef, MaybeConstruct construct)
|
||||
{
|
||||
/* N.B. Must be kept in sync with InvokeSessionGuard::start/invoke */
|
||||
|
||||
@ -781,8 +781,8 @@ InvokeSessionGuard::start(JSContext *cx, const Value &calleev, const Value &this
|
||||
}
|
||||
|
||||
bool
|
||||
ExternalInvoke(JSContext *cx, const Value &thisv, const Value &fval,
|
||||
uintN argc, Value *argv, Value *rval)
|
||||
Invoke(JSContext *cx, const Value &thisv, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval)
|
||||
{
|
||||
LeaveTrace(cx);
|
||||
|
||||
@ -814,8 +814,7 @@ ExternalInvoke(JSContext *cx, const Value &thisv, const Value &fval,
|
||||
}
|
||||
|
||||
bool
|
||||
ExternalInvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval)
|
||||
InvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *argv, Value *rval)
|
||||
{
|
||||
LeaveTrace(cx);
|
||||
|
||||
@ -835,18 +834,18 @@ ExternalInvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *a
|
||||
}
|
||||
|
||||
bool
|
||||
ExternalGetOrSet(JSContext *cx, JSObject *obj, jsid id, const Value &fval,
|
||||
JSAccessMode mode, uintN argc, Value *argv, Value *rval)
|
||||
InvokeGetterOrSetter(JSContext *cx, JSObject *obj, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval)
|
||||
{
|
||||
LeaveTrace(cx);
|
||||
|
||||
/*
|
||||
* ExternalInvoke could result in another try to get or set the same id
|
||||
* again, see bug 355497.
|
||||
* Invoke could result in another try to get or set the same id again, see
|
||||
* bug 355497.
|
||||
*/
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
|
||||
return ExternalInvoke(cx, ObjectValue(*obj), fval, argc, argv, rval);
|
||||
return Invoke(cx, ObjectValue(*obj), fval, argc, argv, rval);
|
||||
}
|
||||
|
||||
#if JS_HAS_SHARP_VARS
|
||||
@ -878,8 +877,8 @@ InitSharpSlots(JSContext *cx, StackFrame *fp)
|
||||
#endif
|
||||
|
||||
bool
|
||||
Execute(JSContext *cx, JSScript *script, JSObject &scopeChain, const Value &thisv,
|
||||
ExecuteType type, StackFrame *evalInFrame, Value *result)
|
||||
ExecuteKernel(JSContext *cx, JSScript *script, JSObject &scopeChain, const Value &thisv,
|
||||
ExecuteType type, StackFrame *evalInFrame, Value *result)
|
||||
{
|
||||
JS_ASSERT_IF(evalInFrame, type == EXECUTE_DEBUG);
|
||||
|
||||
@ -919,7 +918,7 @@ Execute(JSContext *cx, JSScript *script, JSObject &scopeChain, const Value &this
|
||||
}
|
||||
|
||||
bool
|
||||
ExternalExecute(JSContext *cx, JSScript *script, JSObject &scopeChainArg, Value *rval)
|
||||
Execute(JSContext *cx, JSScript *script, JSObject &scopeChainArg, Value *rval)
|
||||
{
|
||||
/* The scope chain could be anything, so innerize just in case. */
|
||||
JSObject *scopeChain = &scopeChainArg;
|
||||
@ -944,8 +943,8 @@ ExternalExecute(JSContext *cx, JSScript *script, JSObject &scopeChainArg, Value
|
||||
return false;
|
||||
Value thisv = ObjectValue(*thisObj);
|
||||
|
||||
return Execute(cx, script, *scopeChain, thisv, EXECUTE_GLOBAL,
|
||||
NULL /* evalInFrame */, rval);
|
||||
return ExecuteKernel(cx, script, *scopeChain, thisv, EXECUTE_GLOBAL,
|
||||
NULL /* evalInFrame */, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1190,7 +1189,7 @@ TypeOfValue(JSContext *cx, const Value &vref)
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK bool
|
||||
InvokeConstructor(JSContext *cx, const CallArgs &argsRef)
|
||||
InvokeConstructorKernel(JSContext *cx, const CallArgs &argsRef)
|
||||
{
|
||||
JS_ASSERT(!js_FunctionClass.construct);
|
||||
CallArgs args = argsRef;
|
||||
@ -1212,7 +1211,7 @@ InvokeConstructor(JSContext *cx, const CallArgs &argsRef)
|
||||
if (!fun->isInterpretedConstructor())
|
||||
goto error;
|
||||
|
||||
if (!Invoke(cx, args, CONSTRUCT))
|
||||
if (!InvokeKernel(cx, args, CONSTRUCT))
|
||||
return false;
|
||||
|
||||
JS_ASSERT(args.rval().isObject());
|
||||
@ -3986,7 +3985,7 @@ BEGIN_CASE(JSOP_EVAL)
|
||||
if (!DirectEval(cx, args))
|
||||
goto error;
|
||||
} else {
|
||||
if (!Invoke(cx, args))
|
||||
if (!InvokeKernel(cx, args))
|
||||
goto error;
|
||||
}
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
@ -4010,10 +4009,10 @@ BEGIN_CASE(JSOP_FUNAPPLY)
|
||||
/* Don't bother trying to fast-path calls to scripted non-constructors. */
|
||||
if (!IsFunctionObject(args.calleev(), &callee, &fun) || !fun->isInterpretedConstructor()) {
|
||||
if (construct) {
|
||||
if (!InvokeConstructor(cx, args))
|
||||
if (!InvokeConstructorKernel(cx, args))
|
||||
goto error;
|
||||
} else {
|
||||
if (!Invoke(cx, args))
|
||||
if (!InvokeKernel(cx, args))
|
||||
goto error;
|
||||
}
|
||||
regs.sp = args.spAfterCall();
|
||||
@ -4590,10 +4589,10 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
*/
|
||||
JSFunction *fun;
|
||||
LOAD_FUNCTION(0);
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JSObject *obj = fun;
|
||||
|
||||
JSObject *obj2;
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
/*
|
||||
* Even a null closure needs a parent for principals finding.
|
||||
* FIXME: bug 476950, although debugger users may also demand some kind
|
||||
@ -4730,10 +4729,10 @@ BEGIN_CASE(JSOP_DEFLOCALFUN)
|
||||
JSFunction *fun;
|
||||
LOAD_FUNCTION(SLOTNO_LEN);
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
JS_ASSERT(!FUN_FLAT_CLOSURE(fun));
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JS_ASSERT(!fun->isFlatClosure());
|
||||
JSObject *obj = fun;
|
||||
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
obj = CloneFunctionObject(cx, fun, ®s.fp()->scopeChain());
|
||||
if (!obj)
|
||||
goto error;
|
||||
@ -4782,12 +4781,12 @@ BEGIN_CASE(JSOP_LAMBDA)
|
||||
/* Load the specified function object literal. */
|
||||
JSFunction *fun;
|
||||
LOAD_FUNCTION(0);
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JSObject *obj = fun;
|
||||
|
||||
/* do-while(0) so we can break instead of using a goto. */
|
||||
do {
|
||||
JSObject *parent;
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
parent = ®s.fp()->scopeChain();
|
||||
|
||||
if (obj->getParent() == parent) {
|
||||
@ -4845,7 +4844,7 @@ BEGIN_CASE(JSOP_LAMBDA)
|
||||
JSObject *callee;
|
||||
|
||||
if (IsFunctionObject(cref, &callee)) {
|
||||
JSFunction *calleeFun = GET_FUNCTION_PRIVATE(cx, callee);
|
||||
JSFunction *calleeFun = callee->getFunctionPrivate();
|
||||
if (Native native = calleeFun->maybeNative()) {
|
||||
if ((iargc == 1 && native == array_sort) ||
|
||||
(iargc == 2 && native == str_replace)) {
|
||||
@ -6092,7 +6091,7 @@ END_CASE(JSOP_ARRAYPUSH)
|
||||
/*
|
||||
* At this point we are inevitably leaving an interpreted function or a
|
||||
* top-level script, and returning to one of:
|
||||
* (a) an "out of line" call made through js_Invoke;
|
||||
* (a) an "out of line" call made through Invoke;
|
||||
* (b) a js_Execute activation;
|
||||
* (c) a generator (SendToGenerator, jsiter.c).
|
||||
*
|
||||
|
@ -145,32 +145,43 @@ inline bool
|
||||
ComputeThis(JSContext *cx, StackFrame *fp);
|
||||
|
||||
/*
|
||||
* The js::InvokeArgumentsGuard passed to js_Invoke must come from an
|
||||
* immediately-enclosing successful call to js::StackSpace::pushInvokeArgs,
|
||||
* i.e., there must have been no un-popped pushes to cx->stack. Furthermore,
|
||||
* |args.getvp()[0]| should be the callee, |args.getvp()[1]| should be |this|,
|
||||
* and the range [args.getvp() + 2, args.getvp() + 2 + args.getArgc()) should
|
||||
* be initialized actual arguments.
|
||||
* InvokeKernel assumes that the given args have been pushed on the top of the
|
||||
* VM stack. Additionally, if 'args' is contained in a CallArgsList, that they
|
||||
* have already been marked 'active'.
|
||||
*/
|
||||
extern bool
|
||||
Invoke(JSContext *cx, const CallArgs &args, MaybeConstruct construct = NO_CONSTRUCT);
|
||||
InvokeKernel(JSContext *cx, const CallArgs &args, MaybeConstruct construct = NO_CONSTRUCT);
|
||||
|
||||
/*
|
||||
* For calls to natives, the InvokeArgsGuard object provides a record of the
|
||||
* call for the debugger's callstack. For this to work, the InvokeArgsGuard
|
||||
* record needs to know when the call is actually active (because the
|
||||
* InvokeArgsGuard can be pushed long before and popped long after the actual
|
||||
* call, during which time many stack-observing things can happen).
|
||||
* Invoke assumes that 'args' has been pushed (via ContextStack::pushInvokeArgs)
|
||||
* and is currently at the top of the VM stack.
|
||||
*/
|
||||
inline bool
|
||||
Invoke(JSContext *cx, InvokeArgsGuard &args, MaybeConstruct construct = NO_CONSTRUCT)
|
||||
{
|
||||
args.setActive();
|
||||
bool ok = Invoke(cx, ImplicitCast<CallArgs>(args), construct);
|
||||
bool ok = InvokeKernel(cx, args, construct);
|
||||
args.setInactive();
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* This Invoke overload places the least requirements on the caller: it may be
|
||||
* called at any time and it takes care of copying the given callee, this, and
|
||||
* arguments onto the stack.
|
||||
*/
|
||||
extern bool
|
||||
Invoke(JSContext *cx, const Value &thisv, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval);
|
||||
|
||||
/*
|
||||
* This helper takes care of the infinite-recursion check necessary for
|
||||
* getter/setter calls.
|
||||
*/
|
||||
extern bool
|
||||
InvokeGetterOrSetter(JSContext *cx, JSObject *obj, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval);
|
||||
|
||||
/*
|
||||
* Natives like sort/forEach/replace call Invoke repeatedly with the same
|
||||
* callee, this, and number of arguments. To optimize this, such natives can
|
||||
@ -198,40 +209,34 @@ Invoke(JSContext *cx, InvokeArgsGuard &args, MaybeConstruct construct = NO_CONST
|
||||
class InvokeSessionGuard;
|
||||
|
||||
/*
|
||||
* "External" calls may come from C or C++ code using a JSContext on which no
|
||||
* JS is running (!cx->fp), so they may need to push a dummy StackFrame.
|
||||
* InvokeConstructor* implement a function call from a constructor context
|
||||
* (e.g. 'new') handling the the creation of the new 'this' object.
|
||||
*/
|
||||
extern JS_REQUIRES_STACK bool
|
||||
InvokeConstructorKernel(JSContext *cx, const CallArgs &args);
|
||||
|
||||
extern bool
|
||||
ExternalInvoke(JSContext *cx, const Value &thisv, const Value &fval,
|
||||
uintN argc, Value *argv, Value *rval);
|
||||
/* See the InvokeArgsGuard overload of Invoke. */
|
||||
inline bool
|
||||
InvokeConstructor(JSContext *cx, InvokeArgsGuard &args)
|
||||
{
|
||||
args.setActive();
|
||||
bool ok = InvokeConstructorKernel(cx, ImplicitCast<CallArgs>(args));
|
||||
args.setInactive();
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* See the fval overload of Invoke. */
|
||||
extern bool
|
||||
ExternalGetOrSet(JSContext *cx, JSObject *obj, jsid id, const Value &fval,
|
||||
JSAccessMode mode, uintN argc, Value *argv, Value *rval);
|
||||
InvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *argv, Value *rval);
|
||||
|
||||
/*
|
||||
* These two functions invoke a function called from a constructor context
|
||||
* (e.g. 'new'). InvokeConstructor handles the general case where a new object
|
||||
* needs to be created for/by the constructor. ConstructWithGivenThis directly
|
||||
* calls the constructor with the given 'this', hence the caller must
|
||||
* understand the semantics of the constructor call.
|
||||
* InvokeConstructorWithGivenThis directly calls the constructor with the given
|
||||
* 'this'; the caller must choose the semantically correct 'this'.
|
||||
*/
|
||||
|
||||
extern JS_REQUIRES_STACK bool
|
||||
InvokeConstructor(JSContext *cx, const CallArgs &args);
|
||||
|
||||
extern JS_REQUIRES_STACK bool
|
||||
InvokeConstructorWithGivenThis(JSContext *cx, JSObject *thisobj, const Value &fval,
|
||||
uintN argc, Value *argv, Value *rval);
|
||||
|
||||
extern bool
|
||||
ExternalInvokeConstructor(JSContext *cx, const Value &fval, uintN argc, Value *argv,
|
||||
Value *rval);
|
||||
|
||||
extern bool
|
||||
ExternalExecute(JSContext *cx, JSScript *script, JSObject &scopeChain, Value *rval);
|
||||
|
||||
/*
|
||||
* Executes a script with the given scopeChain/this. The 'type' indicates
|
||||
* whether this is eval code or global code. To support debugging, the
|
||||
@ -239,8 +244,12 @@ ExternalExecute(JSContext *cx, JSScript *script, JSObject &scopeChain, Value *rv
|
||||
* stack to simulate executing an eval in that frame.
|
||||
*/
|
||||
extern bool
|
||||
Execute(JSContext *cx, JSScript *script, JSObject &scopeChain, const Value &thisv,
|
||||
ExecuteType type, StackFrame *evalInFrame, Value *result);
|
||||
ExecuteKernel(JSContext *cx, JSScript *script, JSObject &scopeChain, const Value &thisv,
|
||||
ExecuteType type, StackFrame *evalInFrame, Value *result);
|
||||
|
||||
/* Execute a script with the given scopeChain as global code. */
|
||||
extern bool
|
||||
Execute(JSContext *cx, JSScript *script, JSObject &scopeChain, Value *rval);
|
||||
|
||||
/* Flags to toggle js::Interpret() execution. */
|
||||
enum InterpMode
|
||||
|
@ -362,7 +362,7 @@ GetCustomIterator(JSContext *cx, JSObject *obj, uintN flags, Value *vp)
|
||||
/* Otherwise call it and return that object. */
|
||||
LeaveTrace(cx);
|
||||
Value arg = BooleanValue((flags & JSITER_FOREACH) == 0);
|
||||
if (!ExternalInvoke(cx, ObjectValue(*obj), *vp, 1, &arg, vp))
|
||||
if (!Invoke(cx, ObjectValue(*obj), *vp, 1, &arg, vp))
|
||||
return false;
|
||||
if (vp->isPrimitive()) {
|
||||
/*
|
||||
@ -954,7 +954,7 @@ js_IteratorMore(JSContext *cx, JSObject *iterobj, Value *rval)
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.nextAtom);
|
||||
if (!js_GetMethod(cx, iterobj, id, JSGET_METHOD_BARRIER, rval))
|
||||
return false;
|
||||
if (!ExternalInvoke(cx, ObjectValue(*iterobj), *rval, 0, NULL, rval)) {
|
||||
if (!Invoke(cx, ObjectValue(*iterobj), *rval, 0, NULL, rval)) {
|
||||
/* Check for StopIteration. */
|
||||
if (!cx->isExceptionPending() || !js_ValueIsStopIteration(cx->getPendingException()))
|
||||
return false;
|
||||
|
@ -1191,7 +1191,6 @@ EvalKernel(JSContext *cx, const CallArgs &call, EvalType evalType, StackFrame *c
|
||||
|
||||
#ifdef DEBUG
|
||||
jsbytecode *callerPC = caller->pcQuadratic(cx);
|
||||
JS_ASSERT_IF(caller->isFunctionFrame(), caller->fun()->isHeavyweight());
|
||||
JS_ASSERT(callerPC && js_GetOpcode(cx, caller->script(), callerPC) == JSOP_EVAL);
|
||||
#endif
|
||||
} else {
|
||||
@ -1275,8 +1274,8 @@ EvalKernel(JSContext *cx, const CallArgs &call, EvalType evalType, StackFrame *c
|
||||
esg.setNewScript(compiled);
|
||||
}
|
||||
|
||||
return Execute(cx, esg.script(), scopeobj, thisv, ExecuteType(evalType),
|
||||
NULL /* evalInFrame */, &call.rval());
|
||||
return ExecuteKernel(cx, esg.script(), scopeobj, thisv, ExecuteType(evalType),
|
||||
NULL /* evalInFrame */, &call.rval());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1405,8 +1404,8 @@ obj_watch_handler(JSContext *cx, JSObject *obj, jsid id, jsval old,
|
||||
return true;
|
||||
|
||||
Value argv[] = { IdToValue(id), Valueify(old), Valueify(*nvp) };
|
||||
return ExternalInvoke(cx, ObjectValue(*obj), ObjectOrNullValue(callable),
|
||||
JS_ARRAY_LENGTH(argv), argv, Valueify(nvp));
|
||||
return Invoke(cx, ObjectValue(*obj), ObjectOrNullValue(callable), JS_ARRAY_LENGTH(argv), argv,
|
||||
Valueify(nvp));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -3919,7 +3918,7 @@ DefineConstructorAndPrototype(JSContext *cx, JSObject *obj, JSProtoKey key, JSAt
|
||||
js_NewFunction(cx, NULL, constructor, nargs, JSFUN_CONSTRUCTOR, obj, atom);
|
||||
if (!fun)
|
||||
goto bad;
|
||||
FUN_CLASP(fun) = clasp;
|
||||
fun->setConstructorClass(clasp);
|
||||
|
||||
AutoValueRooter tvr2(cx, ObjectValue(*fun));
|
||||
if (!DefineStandardSlot(cx, obj, key, atom, tvr2.value(), 0, named))
|
||||
@ -3931,7 +3930,7 @@ DefineConstructorAndPrototype(JSContext *cx, JSObject *obj, JSProtoKey key, JSAt
|
||||
* different object, as is done for operator new -- and as at least
|
||||
* XML support requires.
|
||||
*/
|
||||
ctor = FUN_OBJECT(fun);
|
||||
ctor = fun;
|
||||
if (clasp->flags & JSCLASS_CONSTRUCT_PROTOTYPE) {
|
||||
Value rval;
|
||||
if (!InvokeConstructorWithGivenThis(cx, proto, ObjectOrNullValue(ctor),
|
||||
@ -4709,7 +4708,7 @@ DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value,
|
||||
JS_ASSERT(!getter && !setter);
|
||||
|
||||
JSObject *funobj = &value.toObject();
|
||||
if (FUN_OBJECT(GET_FUNCTION_PRIVATE(cx, funobj)) == funobj) {
|
||||
if (funobj->getFunctionPrivate() == funobj) {
|
||||
flags |= Shape::METHOD;
|
||||
getter = CastAsPropertyOp(funobj);
|
||||
}
|
||||
@ -5449,7 +5448,7 @@ JSObject::callMethod(JSContext *cx, jsid id, uintN argc, Value *argv, Value *vp)
|
||||
{
|
||||
Value fval;
|
||||
return js_GetMethod(cx, this, id, JSGET_NO_METHOD_BARRIER, &fval) &&
|
||||
ExternalInvoke(cx, ObjectValue(*this), fval, argc, argv, vp);
|
||||
Invoke(cx, ObjectValue(*this), fval, argc, argv, vp);
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -5662,7 +5661,7 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
|
||||
JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
|
||||
|
||||
JSObject *funobj = &vp->toObject();
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
if (fun == funobj) {
|
||||
flags |= Shape::METHOD;
|
||||
getter = CastAsPropertyOp(funobj);
|
||||
@ -5797,7 +5796,7 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool str
|
||||
JSObject *funobj;
|
||||
|
||||
if (IsFunctionObject(v, &funobj)) {
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
|
||||
if (fun != funobj) {
|
||||
for (StackFrame *fp = cx->maybefp(); fp; fp = fp->prev()) {
|
||||
@ -5854,7 +5853,7 @@ MaybeCallMethod(JSContext *cx, JSObject *obj, jsid id, Value *vp)
|
||||
*vp = ObjectValue(*obj);
|
||||
return true;
|
||||
}
|
||||
return ExternalInvoke(cx, ObjectValue(*obj), *vp, 0, NULL, vp);
|
||||
return Invoke(cx, ObjectValue(*obj), *vp, 0, NULL, vp);
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -6492,7 +6491,7 @@ dumpValue(const Value &v)
|
||||
dumpString(v.toString());
|
||||
else if (v.isObject() && v.toObject().isFunction()) {
|
||||
JSObject *funobj = &v.toObject();
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
if (fun->atom) {
|
||||
fputs("<function ", stderr);
|
||||
FileEscapedString(stderr, fun->atom, 0);
|
||||
|
@ -218,7 +218,7 @@ JSObject::methodReadBarrier(JSContext *cx, const js::Shape &shape, js::Value *vp
|
||||
JSObject *funobj = &vp->toObject();
|
||||
JSFunction *fun = funobj->getFunctionPrivate();
|
||||
JS_ASSERT(fun == funobj);
|
||||
JS_ASSERT(FUN_NULL_CLOSURE(fun));
|
||||
JS_ASSERT(fun->isNullClosure());
|
||||
|
||||
funobj = CloneFunctionObject(cx, fun, funobj->getParent());
|
||||
if (!funobj)
|
||||
@ -550,7 +550,7 @@ inline void
|
||||
JSObject::setFlatClosureUpvars(js::Value *upvars)
|
||||
{
|
||||
JS_ASSERT(isFunction());
|
||||
JS_ASSERT(FUN_FLAT_CLOSURE(getFunctionPrivate()));
|
||||
JS_ASSERT(getFunctionPrivate()->isFlatClosure());
|
||||
setSlot(JSSLOT_FLAT_CLOSURE_UPVARS, PrivateValue(upvars));
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ ToDisassemblySource(JSContext *cx, jsval v, JSAutoByteString *bytes)
|
||||
}
|
||||
|
||||
if (clasp == &js_FunctionClass) {
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSFunction *fun = obj->getFunctionPrivate();
|
||||
JSString *str = JS_DecompileFunction(cx, fun, JS_DONT_PRETTY_PRINT);
|
||||
if (!str)
|
||||
return false;
|
||||
@ -4972,7 +4972,7 @@ js_DecompileFunctionBody(JSPrinter *jp)
|
||||
|
||||
JS_ASSERT(jp->fun);
|
||||
JS_ASSERT(!jp->script);
|
||||
if (!FUN_INTERPRETED(jp->fun)) {
|
||||
if (!jp->fun->isInterpreted()) {
|
||||
js_printf(jp, native_code_str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -5011,7 +5011,7 @@ js_DecompileFunction(JSPrinter *jp)
|
||||
return JS_FALSE;
|
||||
js_puts(jp, "(");
|
||||
|
||||
if (!FUN_INTERPRETED(fun)) {
|
||||
if (!fun->isInterpreted()) {
|
||||
js_printf(jp, ") {\n");
|
||||
jp->indent += 4;
|
||||
js_printf(jp, native_code_str);
|
||||
|
@ -313,7 +313,7 @@ Parser::newFunctionBox(JSObject *obj, JSParseNode *fn, JSTreeContext *tc)
|
||||
bool
|
||||
JSFunctionBox::joinable() const
|
||||
{
|
||||
return FUN_NULL_CLOSURE(function()) &&
|
||||
return function()->isNullClosure() &&
|
||||
!(tcflags & (TCF_FUN_USES_ARGUMENTS | TCF_FUN_USES_OWN_NAME));
|
||||
}
|
||||
|
||||
@ -990,7 +990,7 @@ Compiler::compileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
|
||||
* function captured in case it refers to an upvar, and someone
|
||||
* wishes to decompile it while it's running.
|
||||
*/
|
||||
JSObjectBox *funbox = parser.newObjectBox(FUN_OBJECT(callerFrame->fun()));
|
||||
JSObjectBox *funbox = parser.newObjectBox(callerFrame->fun());
|
||||
if (!funbox)
|
||||
goto out;
|
||||
funbox->emitLink = cg.objectList.lastbox;
|
||||
@ -1978,8 +1978,8 @@ Parser::newFunction(JSTreeContext *tc, JSAtom *atom, FunctionSyntaxKind kind)
|
||||
JSFUN_INTERPRETED | (kind == Expression ? JSFUN_LAMBDA : 0),
|
||||
parent, atom);
|
||||
if (fun && !tc->compileAndGo()) {
|
||||
FUN_OBJECT(fun)->clearParent();
|
||||
FUN_OBJECT(fun)->clearProto();
|
||||
fun->clearParent();
|
||||
fun->clearProto();
|
||||
}
|
||||
return fun;
|
||||
}
|
||||
@ -2461,12 +2461,12 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
|
||||
JSFunction *fun = funbox->function();
|
||||
|
||||
JS_ASSERT(FUN_KIND(fun) == JSFUN_INTERPRETED);
|
||||
JS_ASSERT(fun->kind() == JSFUN_INTERPRETED);
|
||||
|
||||
if (funbox->tcflags & TCF_FUN_HEAVYWEIGHT) {
|
||||
/* nothing to do */
|
||||
} else if (funbox->inAnyDynamicScope()) {
|
||||
JS_ASSERT(!FUN_NULL_CLOSURE(fun));
|
||||
JS_ASSERT(!fun->isNullClosure());
|
||||
} else if (pn->pn_type != TOK_UPVARS) {
|
||||
/*
|
||||
* No lexical dependencies => null closure, for best performance.
|
||||
@ -2484,7 +2484,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
*
|
||||
* FIXME: bug 476950.
|
||||
*/
|
||||
FUN_SET_KIND(fun, JSFUN_NULL_CLOSURE);
|
||||
fun->setKind(JSFUN_NULL_CLOSURE);
|
||||
} else {
|
||||
AtomDefnMapPtr upvars = pn->pn_names;
|
||||
JS_ASSERT(!upvars->empty());
|
||||
@ -2512,7 +2512,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
}
|
||||
|
||||
if (r.empty())
|
||||
FUN_SET_KIND(fun, JSFUN_NULL_CLOSURE);
|
||||
fun->setKind(JSFUN_NULL_CLOSURE);
|
||||
} else {
|
||||
uintN nupvars = 0, nflattened = 0;
|
||||
|
||||
@ -2550,13 +2550,13 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
}
|
||||
|
||||
if (nupvars == 0) {
|
||||
FUN_SET_KIND(fun, JSFUN_NULL_CLOSURE);
|
||||
fun->setKind(JSFUN_NULL_CLOSURE);
|
||||
} else if (nflattened == nupvars) {
|
||||
/*
|
||||
* We made it all the way through the upvar loop, so it's
|
||||
* safe to optimize to a flat closure.
|
||||
*/
|
||||
FUN_SET_KIND(fun, JSFUN_FLAT_CLOSURE);
|
||||
fun->setKind(JSFUN_FLAT_CLOSURE);
|
||||
switch (PN_OP(fn)) {
|
||||
case JSOP_DEFFUN:
|
||||
fn->pn_op = JSOP_DEFFUN_FC;
|
||||
@ -2575,7 +2575,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
}
|
||||
}
|
||||
|
||||
if (FUN_KIND(fun) == JSFUN_INTERPRETED && pn->pn_type == TOK_UPVARS) {
|
||||
if (fun->kind() == JSFUN_INTERPRETED && pn->pn_type == TOK_UPVARS) {
|
||||
/*
|
||||
* One or more upvars cannot be safely snapshot into a flat
|
||||
* closure's non-reserved slot (see JSOP_GETFCSLOT), so we loop
|
||||
@ -2621,7 +2621,7 @@ Parser::markExtensibleScopeDescendants(JSFunctionBox *funbox, bool hasExtensible
|
||||
{
|
||||
for (; funbox; funbox = funbox->siblings) {
|
||||
/*
|
||||
* It would be nice to use FUN_KIND(fun) here to recognize functions
|
||||
* It would be nice to use fun->kind() here to recognize functions
|
||||
* that will never consult their parent chains, and thus don't need
|
||||
* their 'extensible parents' flag set. Filed as bug 619750.
|
||||
*/
|
||||
@ -2663,7 +2663,7 @@ EnterFunction(JSParseNode *fn, JSTreeContext *funtc, JSAtom *funAtom = NULL,
|
||||
return NULL;
|
||||
|
||||
/* Create box for fun->object early to protect against last-ditch GC. */
|
||||
JSFunctionBox *funbox = tc->parser->newFunctionBox(FUN_OBJECT(fun), fn, tc);
|
||||
JSFunctionBox *funbox = tc->parser->newFunctionBox(fun, fn, tc);
|
||||
if (!funbox)
|
||||
return NULL;
|
||||
|
||||
|
@ -90,10 +90,10 @@ FunctionName(JSContext *cx, const JSFunction *fun, JSAutoByteString* bytes)
|
||||
static const char *
|
||||
FunctionClassname(const JSFunction *fun)
|
||||
{
|
||||
if (!fun || FUN_INTERPRETED(fun))
|
||||
if (!fun || fun->isInterpreted())
|
||||
return Probes::nullName;
|
||||
if (!(fun->flags & JSFUN_TRCINFO) && FUN_CLASP(fun))
|
||||
return (char *)FUN_CLASP(fun)->name;
|
||||
if (!(fun->flags & JSFUN_TRCINFO) && fun->getConstructorClass())
|
||||
return fun->getConstructorClass()->name;
|
||||
return Probes::nullName;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, JSObject *po
|
||||
if (!pobj->branded()) {
|
||||
PCMETER(brandfills++);
|
||||
#ifdef DEBUG_notme
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(v));
|
||||
JSFunction *fun = JSVAL_TO_OBJECT(v)->getFunctionPrivate();
|
||||
JSAutoByteString funNameBytes;
|
||||
if (const char *funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
|
||||
fprintf(stderr,
|
||||
|
@ -129,10 +129,8 @@ JSProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id,
|
||||
*vp = desc.value;
|
||||
return true;
|
||||
}
|
||||
if (desc.attrs & JSPROP_GETTER) {
|
||||
return ExternalGetOrSet(cx, receiver, id, CastAsObjectJsval(desc.getter),
|
||||
JSACC_READ, 0, NULL, vp);
|
||||
}
|
||||
if (desc.attrs & JSPROP_GETTER)
|
||||
return InvokeGetterOrSetter(cx, receiver, CastAsObjectJsval(desc.getter), 0, NULL, vp);
|
||||
if (!(desc.attrs & JSPROP_SHARED))
|
||||
*vp = desc.value;
|
||||
else
|
||||
@ -275,8 +273,7 @@ JSProxyHandler::call(JSContext *cx, JSObject *proxy, uintN argc, Value *vp)
|
||||
{
|
||||
JS_ASSERT(OperationInProgress(cx, proxy));
|
||||
AutoValueRooter rval(cx);
|
||||
JSBool ok = ExternalInvoke(cx, vp[1], GetCall(proxy), argc, JS_ARGV(cx, vp),
|
||||
rval.addr());
|
||||
JSBool ok = Invoke(cx, vp[1], GetCall(proxy), argc, JS_ARGV(cx, vp), rval.addr());
|
||||
if (ok)
|
||||
JS_SET_RVAL(cx, vp, rval.value());
|
||||
return ok;
|
||||
@ -289,8 +286,8 @@ JSProxyHandler::construct(JSContext *cx, JSObject *proxy,
|
||||
JS_ASSERT(OperationInProgress(cx, proxy));
|
||||
Value fval = GetConstruct(proxy);
|
||||
if (fval.isUndefined())
|
||||
return ExternalInvokeConstructor(cx, GetCall(proxy), argc, argv, rval);
|
||||
return ExternalInvoke(cx, UndefinedValue(), fval, argc, argv, rval);
|
||||
return InvokeConstructor(cx, GetCall(proxy), argc, argv, rval);
|
||||
return Invoke(cx, UndefinedValue(), fval, argc, argv, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -359,7 +356,7 @@ GetDerivedTrap(JSContext *cx, JSObject *handler, JSAtom *atom, Value *fvalp)
|
||||
static bool
|
||||
Trap(JSContext *cx, JSObject *handler, Value fval, uintN argc, Value* argv, Value *rval)
|
||||
{
|
||||
return ExternalInvoke(cx, ObjectValue(*handler), fval, argc, argv, rval);
|
||||
return Invoke(cx, ObjectValue(*handler), fval, argc, argv, rval);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1117,9 +1114,7 @@ proxy_Construct(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
JSObject *proxy = &JS_CALLEE(cx, vp).toObject();
|
||||
JS_ASSERT(proxy->isProxy());
|
||||
Value rval;
|
||||
bool ok = JSProxy::construct(cx, proxy, argc, JS_ARGV(cx, vp), &rval);
|
||||
*vp = rval;
|
||||
bool ok = JSProxy::construct(cx, proxy, argc, JS_ARGV(cx, vp), vp);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1315,9 +1310,7 @@ callable_Call(JSContext *cx, uintN argc, Value *vp)
|
||||
JS_ASSERT(callable->getClass() == &CallableObjectClass);
|
||||
const Value &fval = callable->getSlot(JSSLOT_CALLABLE_CALL);
|
||||
const Value &thisval = vp[1];
|
||||
Value rval;
|
||||
bool ok = ExternalInvoke(cx, thisval, fval, argc, JS_ARGV(cx, vp), &rval);
|
||||
*vp = rval;
|
||||
bool ok = Invoke(cx, thisval, fval, argc, JS_ARGV(cx, vp), vp);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1355,8 +1348,8 @@ callable_Construct(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
/* If the call returns an object, return that, otherwise the original newobj. */
|
||||
Value rval;
|
||||
if (!ExternalInvoke(cx, ObjectValue(*newobj), callable->getSlot(JSSLOT_CALLABLE_CALL),
|
||||
argc, vp + 2, &rval)) {
|
||||
if (!Invoke(cx, ObjectValue(*newobj), callable->getSlot(JSSLOT_CALLABLE_CALL),
|
||||
argc, vp + 2, &rval)) {
|
||||
return false;
|
||||
}
|
||||
if (rval.isPrimitive())
|
||||
@ -1366,9 +1359,7 @@ callable_Construct(JSContext *cx, uintN argc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
Value rval;
|
||||
bool ok = ExternalInvoke(cx, ObjectValue(*thisobj), fval, argc, vp + 2, &rval);
|
||||
*vp = rval;
|
||||
bool ok = Invoke(cx, ObjectValue(*thisobj), fval, argc, vp + 2, vp);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -231,11 +231,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { NullValue() }; /* no zero-length arrays allowed! */
|
||||
return ExternalInvoke(cx, userv, fun, 0, argv, dst);
|
||||
return Invoke(cx, userv, fun, 0, argv, dst);
|
||||
}
|
||||
|
||||
bool callback(Value fun, Value v1, TokenPos *pos, Value *dst) {
|
||||
@ -244,11 +244,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { v1, loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { v1 };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
bool callback(Value fun, Value v1, Value v2, TokenPos *pos, Value *dst) {
|
||||
@ -257,11 +257,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { v1, v2, loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { v1, v2 };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
bool callback(Value fun, Value v1, Value v2, Value v3, TokenPos *pos, Value *dst) {
|
||||
@ -270,11 +270,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { v1, v2, v3, loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { v1, v2, v3 };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
bool callback(Value fun, Value v1, Value v2, Value v3, Value v4, TokenPos *pos, Value *dst) {
|
||||
@ -283,11 +283,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { v1, v2, v3, v4, loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { v1, v2, v3, v4 };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
bool callback(Value fun, Value v1, Value v2, Value v3, Value v4, Value v5,
|
||||
@ -297,11 +297,11 @@ class NodeBuilder
|
||||
if (!newNodeLoc(pos, &loc))
|
||||
return false;
|
||||
Value argv[] = { v1, v2, v3, v4, v5, loc };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value argv[] = { v1, v2, v3, v4, v5 };
|
||||
return ExternalInvoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
return Invoke(cx, userv, fun, JS_ARRAY_LENGTH(argv), argv, dst);
|
||||
}
|
||||
|
||||
Value opt(Value v) {
|
||||
|
@ -267,7 +267,7 @@ Shape::get(JSContext* cx, JSObject *receiver, JSObject* obj, JSObject *pobj, js:
|
||||
if (hasGetterValue()) {
|
||||
JS_ASSERT(!isMethod());
|
||||
js::Value fval = getterValue();
|
||||
return js::ExternalGetOrSet(cx, receiver, propid, fval, JSACC_READ, 0, 0, vp);
|
||||
return js::InvokeGetterOrSetter(cx, receiver, fval, 0, 0, vp);
|
||||
}
|
||||
|
||||
if (isMethod()) {
|
||||
@ -291,7 +291,7 @@ Shape::set(JSContext* cx, JSObject* obj, bool strict, js::Value* vp) const
|
||||
|
||||
if (attrs & JSPROP_SETTER) {
|
||||
js::Value fval = setterValue();
|
||||
return js::ExternalGetOrSet(cx, obj, propid, fval, JSACC_WRITE, 1, vp, vp);
|
||||
return js::InvokeGetterOrSetter(cx, obj, fval, 1, vp, vp);
|
||||
}
|
||||
|
||||
if (attrs & JSPROP_GETTER)
|
||||
|
@ -1234,7 +1234,7 @@ JSScript::NewScriptFromCG(JSContext *cx, JSCodeGenerator *cg)
|
||||
if (cg->inFunction()) {
|
||||
/*
|
||||
* We initialize fun->u.i.script to be the script constructed above
|
||||
* so that the debugger has a valid FUN_SCRIPT(fun).
|
||||
* so that the debugger has a valid fun->script().
|
||||
*/
|
||||
fun = cg->fun();
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
|
@ -120,7 +120,7 @@ JSScript::getFunction(size_t index)
|
||||
JS_ASSERT(funobj->isFunction());
|
||||
JS_ASSERT(funobj == (JSObject *) funobj->getPrivate());
|
||||
JSFunction *fun = (JSFunction *) funobj;
|
||||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
return fun;
|
||||
}
|
||||
|
||||
|
@ -3504,7 +3504,7 @@ js_ValueToSource(JSContext *cx, const Value &v)
|
||||
if (!js_GetMethod(cx, &v.toObject(), id, JSGET_NO_METHOD_BARRIER, &fval))
|
||||
return false;
|
||||
if (js_IsCallable(fval)) {
|
||||
if (!ExternalInvoke(cx, v, fval, 0, NULL, &rval))
|
||||
if (!Invoke(cx, v, fval, 0, NULL, &rval))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2810,7 +2810,7 @@ ValueToNative(const Value &v, JSValueType type, double* slot)
|
||||
|
||||
case JSVAL_TYPE_FUNOBJ: {
|
||||
JS_ASSERT(IsFunctionObject(v));
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, &v.toObject());
|
||||
JSFunction* fun = v.toObject().getFunctionPrivate();
|
||||
#if defined JS_JIT_SPEW
|
||||
if (LogController.lcbits & LC_TMTracer) {
|
||||
char funName[40];
|
||||
@ -3109,7 +3109,7 @@ NativeToValue(JSContext* cx, Value& v, JSValueType type, double* slot)
|
||||
JS_ASSERT(IsFunctionObject(v));
|
||||
#if defined JS_JIT_SPEW
|
||||
if (LogController.lcbits & LC_TMTracer) {
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, &v.toObject());
|
||||
JSFunction* fun = v.toObject().getFunctionPrivate();
|
||||
char funName[40];
|
||||
if (fun->atom)
|
||||
JS_PutEscapedFlatString(funName, sizeof funName, fun->atom, 0);
|
||||
@ -3385,7 +3385,7 @@ GetUpvarOnTrace(JSContext* cx, uint32 upvarLevel, int32 slot, uint32 callDepth,
|
||||
*/
|
||||
stackOffset -= fi->callerHeight;
|
||||
JSObject* callee = *(JSObject**)(&state->stackBase[stackOffset]);
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, callee);
|
||||
JSFunction* fun = callee->getFunctionPrivate();
|
||||
uintN calleeLevel = fun->script()->staticLevel;
|
||||
if (calleeLevel == upvarLevel) {
|
||||
/*
|
||||
@ -10541,7 +10541,7 @@ static JSBool JS_FASTCALL
|
||||
functionProbe(JSContext *cx, JSFunction *fun, int enter)
|
||||
{
|
||||
#ifdef MOZ_TRACE_JSCALLS
|
||||
JSScript *script = fun ? FUN_SCRIPT(fun) : NULL;
|
||||
JSScript *script = fun ? fun->maybeScript() : NULL;
|
||||
if (enter > 0)
|
||||
Probes::enterJSFun(cx, fun, script, enter);
|
||||
else
|
||||
@ -11011,7 +11011,7 @@ TraceRecorder::getClassPrototype(JSObject* ctor, LIns*& proto_ins)
|
||||
{
|
||||
// ctor must be a function created via js_InitClass.
|
||||
#ifdef DEBUG
|
||||
Class *clasp = FUN_CLASP(GET_FUNCTION_PRIVATE(cx, ctor));
|
||||
Class *clasp = ctor->getFunctionPrivate()->getConstructorClass();
|
||||
JS_ASSERT(clasp);
|
||||
|
||||
TraceMonitor &localtm = *traceMonitor;
|
||||
@ -11553,7 +11553,7 @@ TraceRecorder::callNative(uintN argc, JSOp mode)
|
||||
}
|
||||
|
||||
if (fun->flags & JSFUN_TRCINFO) {
|
||||
JSNativeTraceInfo *trcinfo = FUN_TRCINFO(fun);
|
||||
JSNativeTraceInfo *trcinfo = fun->getTraceInfo();
|
||||
JS_ASSERT(trcinfo && fun->u.n.native == trcinfo->native);
|
||||
|
||||
/* Try to call a type specialized version of the native. */
|
||||
@ -11708,10 +11708,10 @@ TraceRecorder::functionCall(uintN argc, JSOp mode)
|
||||
* Bytecode sequences that push shapeless callees must guard on the callee
|
||||
* class being Function and the function being interpreted.
|
||||
*/
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, &fval.toObject());
|
||||
JSFunction* fun = fval.toObject().getFunctionPrivate();
|
||||
|
||||
if (Probes::callTrackingActive(cx)) {
|
||||
JSScript *script = FUN_SCRIPT(fun);
|
||||
JSScript *script = fun->maybeScript();
|
||||
if (!script || !script->isEmpty()) {
|
||||
LIns* args[] = { w.immi(1), w.nameImmpNonGC(fun), cx_ins };
|
||||
LIns* call_ins = w.call(&functionProbe_ci, args);
|
||||
@ -11719,7 +11719,7 @@ TraceRecorder::functionCall(uintN argc, JSOp mode)
|
||||
}
|
||||
}
|
||||
|
||||
if (FUN_INTERPRETED(fun))
|
||||
if (fun->isInterpreted())
|
||||
return interpretedFunctionCall(fval, fun, argc, mode == JSOP_NEW);
|
||||
|
||||
Native native = fun->maybeNative();
|
||||
@ -13617,7 +13617,8 @@ TraceRecorder::guardCallee(Value& callee)
|
||||
* private data) case as noted above.
|
||||
*/
|
||||
if (callee_fun->isInterpreted() &&
|
||||
(!FUN_NULL_CLOSURE(callee_fun) || callee_fun->script()->bindings.hasUpvars())) {
|
||||
(!callee_fun->isNullClosure() || callee_fun->script()->bindings.hasUpvars()))
|
||||
{
|
||||
JSObject* parent = callee_obj.getParent();
|
||||
|
||||
if (parent != globalObj) {
|
||||
@ -13819,8 +13820,8 @@ TraceRecorder::record_JSOP_FUNAPPLY()
|
||||
RETURN_IF_XML_A(vp[0]);
|
||||
|
||||
JSObject* obj = &vp[0].toObject();
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
if (FUN_INTERPRETED(fun))
|
||||
JSFunction* fun = obj->getFunctionPrivate();
|
||||
if (fun->isInterpreted())
|
||||
return record_JSOP_CALL();
|
||||
|
||||
bool apply = fun->u.n.native == js_fun_apply;
|
||||
@ -15422,7 +15423,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
JSFunction* fun;
|
||||
fun = cx->fp()->script()->getFunction(getFullIndex());
|
||||
|
||||
if (FUN_NULL_CLOSURE(fun) && FUN_OBJECT(fun)->getParent() != globalObj)
|
||||
if (fun->isNullClosure() && fun->getParent() != globalObj)
|
||||
RETURN_STOP_A("Null closure function object parent must be global object");
|
||||
|
||||
/*
|
||||
@ -15436,12 +15437,12 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
* JSOP_INITMETHOD logic governing the early ARECORD_CONTINUE returns below
|
||||
* must agree with the corresponding break-from-do-while(0) logic there.
|
||||
*/
|
||||
if (FUN_NULL_CLOSURE(fun) && FUN_OBJECT(fun)->getParent() == &cx->fp()->scopeChain()) {
|
||||
if (fun->isNullClosure() && fun->getParent() == &cx->fp()->scopeChain()) {
|
||||
jsbytecode *pc2 = AdvanceOverBlockchainOp(cx->regs().pc + JSOP_LAMBDA_LENGTH);
|
||||
JSOp op2 = JSOp(*pc2);
|
||||
|
||||
if (op2 == JSOP_INITMETHOD) {
|
||||
stack(0, w.immpObjGC(FUN_OBJECT(fun)));
|
||||
stack(0, w.immpObjGC(fun));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
|
||||
@ -15449,7 +15450,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
Value lval = stackval(-1);
|
||||
|
||||
if (!lval.isPrimitive() && lval.toObject().canHaveMethodBarrier()) {
|
||||
stack(0, w.immpObjGC(FUN_OBJECT(fun)));
|
||||
stack(0, w.immpObjGC(fun));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
} else if (fun->joinable()) {
|
||||
@ -15477,7 +15478,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
|
||||
if ((iargc == 1 && native == array_sort) ||
|
||||
(iargc == 2 && native == str_replace)) {
|
||||
stack(0, w.immpObjGC(FUN_OBJECT(fun)));
|
||||
stack(0, w.immpObjGC(fun));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
}
|
||||
@ -15486,7 +15487,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
op2 = JSOp(*pc2);
|
||||
|
||||
if (op2 == JSOP_CALL && GET_ARGC(pc2) == 0) {
|
||||
stack(0, w.immpObjGC(FUN_OBJECT(fun)));
|
||||
stack(0, w.immpObjGC(fun));
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
}
|
||||
@ -15497,6 +15498,9 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
|
||||
LIns* args[] = { w.immpObjGC(globalObj), proto_ins, w.immpFunGC(fun), cx_ins };
|
||||
LIns* x = w.call(&js_NewNullClosure_ci, args);
|
||||
guard(false,
|
||||
w.name(w.eqp0(x), "guard(js_NewNullClosure_ci)"),
|
||||
OOM_EXIT);
|
||||
stack(0, x);
|
||||
return ARECORD_CONTINUE;
|
||||
}
|
||||
@ -15524,7 +15528,7 @@ TraceRecorder::record_JSOP_LAMBDA_FC()
|
||||
JSFunction* fun;
|
||||
fun = cx->fp()->script()->getFunction(getFullIndex());
|
||||
|
||||
if (FUN_OBJECT(fun)->getParent() != globalObj)
|
||||
if (fun->getParent() != globalObj)
|
||||
return ARECORD_STOP;
|
||||
|
||||
if (GetBlockChainFast(cx, cx->fp(), JSOP_LAMBDA_FC, JSOP_LAMBDA_FC_LENGTH))
|
||||
@ -15672,9 +15676,9 @@ TraceRecorder::record_JSOP_ARGCNT()
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus
|
||||
TraceRecorder::record_DefLocalFunSetSlot(uint32 slot, JSObject* obj)
|
||||
{
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSFunction* fun = obj->getFunctionPrivate();
|
||||
|
||||
if (FUN_NULL_CLOSURE(fun) && FUN_OBJECT(fun)->getParent() == globalObj) {
|
||||
if (fun->isNullClosure() && fun->getParent() == globalObj) {
|
||||
LIns *proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Function, proto_ins));
|
||||
|
||||
@ -16012,7 +16016,7 @@ TraceRecorder::record_JSOP_CALLPROP()
|
||||
|
||||
if (pcval.isFunObj()) {
|
||||
if (l.isPrimitive()) {
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, &pcval.toFunObj());
|
||||
JSFunction* fun = pcval.toFunObj().getFunctionPrivate();
|
||||
if (fun->isInterpreted() && !fun->inStrictMode())
|
||||
RETURN_STOP_A("callee does not accept primitive |this|");
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ ErrorCopier::~ErrorCopier()
|
||||
cx->isExceptionPending())
|
||||
{
|
||||
Value exc = cx->getPendingException();
|
||||
if (exc.isObject() && exc.toObject().isError()) {
|
||||
if (exc.isObject() && exc.toObject().isError() && exc.toObject().getPrivate()) {
|
||||
cx->clearPendingException();
|
||||
ac.leave();
|
||||
JSObject *copyobj = js_CopyErrorObject(cx, &exc.toObject(), scope);
|
||||
|
@ -1643,7 +1643,7 @@ GetXMLSetting(JSContext *cx, const char *name, jsval *vp)
|
||||
|
||||
if (!js_FindClassObject(cx, NULL, JSProto_XML, Valueify(&v)))
|
||||
return JS_FALSE;
|
||||
if (!VALUE_IS_FUNCTION(cx, v)) {
|
||||
if (JSVAL_IS_PRIMITIVE(v) || !JSVAL_TO_OBJECT(v)->isFunction()) {
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -5153,7 +5153,8 @@ StartNonListXMLMethod(JSContext *cx, jsval *vp, JSObject **objp)
|
||||
JSFunction *fun;
|
||||
char numBuf[12];
|
||||
|
||||
JS_ASSERT(VALUE_IS_FUNCTION(cx, *vp));
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(*vp));
|
||||
JS_ASSERT(JSVAL_TO_OBJECT(*vp)->isFunction());
|
||||
|
||||
*objp = ToObject(cx, Valueify(&vp[1]));
|
||||
if (!*objp)
|
||||
@ -5177,7 +5178,7 @@ StartNonListXMLMethod(JSContext *cx, jsval *vp, JSObject **objp)
|
||||
}
|
||||
}
|
||||
|
||||
fun = GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(*vp));
|
||||
fun = JSVAL_TO_OBJECT(*vp)->getFunctionPrivate();
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%u", xml->xml_kids.length);
|
||||
JSAutoByteString funNameBytes;
|
||||
if (const char *funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
|
||||
@ -7500,7 +7501,7 @@ GetXMLFunction(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
for (;;) {
|
||||
if (!js_GetProperty(cx, target, id, Valueify(vp)))
|
||||
return false;
|
||||
if (VALUE_IS_FUNCTION(cx, *vp))
|
||||
if (!JSVAL_IS_PRIMITIVE(*vp) && JSVAL_TO_OBJECT(*vp)->isFunction())
|
||||
return true;
|
||||
target = target->getProto();
|
||||
if (target == NULL || !target->isNative())
|
||||
|
@ -114,6 +114,7 @@ top:
|
||||
continue;
|
||||
|
||||
jsbytecode *pc = script->main + tn->start + tn->length;
|
||||
cx->regs().pc = pc;
|
||||
JSBool ok = js_UnwindScope(cx, tn->stackDepth, JS_TRUE);
|
||||
JS_ASSERT(cx->regs().sp == fp->base() + tn->stackDepth);
|
||||
|
||||
@ -191,14 +192,14 @@ InlineReturn(VMFrame &f)
|
||||
void JS_FASTCALL
|
||||
stubs::SlowCall(VMFrame &f, uint32 argc)
|
||||
{
|
||||
if (!Invoke(f.cx, CallArgsFromSp(argc, f.regs.sp)))
|
||||
if (!InvokeKernel(f.cx, CallArgsFromSp(argc, f.regs.sp)))
|
||||
THROW();
|
||||
}
|
||||
|
||||
void JS_FASTCALL
|
||||
stubs::SlowNew(VMFrame &f, uint32 argc)
|
||||
{
|
||||
if (!InvokeConstructor(f.cx, CallArgsFromSp(argc, f.regs.sp)))
|
||||
if (!InvokeConstructorKernel(f.cx, CallArgsFromSp(argc, f.regs.sp)))
|
||||
THROW();
|
||||
}
|
||||
|
||||
@ -378,7 +379,7 @@ stubs::UncachedNewHelper(VMFrame &f, uint32 argc, UncachedCallResult *ucr)
|
||||
if (!UncachedInlineCall(f, CONSTRUCT, &ucr->codeAddr, &ucr->unjittable, argc))
|
||||
THROW();
|
||||
} else {
|
||||
if (!InvokeConstructor(cx, args))
|
||||
if (!InvokeConstructorKernel(cx, args))
|
||||
THROW();
|
||||
}
|
||||
}
|
||||
@ -397,7 +398,7 @@ stubs::Eval(VMFrame &f, uint32 argc)
|
||||
CallArgs args = CallArgsFromSp(argc, f.regs.sp);
|
||||
|
||||
if (!IsBuiltinEvalForScope(&f.fp()->scopeChain(), args.calleev())) {
|
||||
if (!Invoke(f.cx, args))
|
||||
if (!InvokeKernel(f.cx, args))
|
||||
THROW();
|
||||
return;
|
||||
}
|
||||
@ -419,7 +420,7 @@ stubs::UncachedCallHelper(VMFrame &f, uint32 argc, UncachedCallResult *ucr)
|
||||
|
||||
if (IsFunctionObject(args.calleev(), &ucr->callee)) {
|
||||
ucr->callee = &args.callee();
|
||||
ucr->fun = GET_FUNCTION_PRIVATE(cx, ucr->callee);
|
||||
ucr->fun = ucr->callee->getFunctionPrivate();
|
||||
|
||||
if (ucr->fun->isInterpreted()) {
|
||||
if (!UncachedInlineCall(f, NO_CONSTRUCT, &ucr->codeAddr, &ucr->unjittable, argc))
|
||||
@ -434,7 +435,7 @@ stubs::UncachedCallHelper(VMFrame &f, uint32 argc, UncachedCallResult *ucr)
|
||||
}
|
||||
}
|
||||
|
||||
if (!Invoke(f.cx, args))
|
||||
if (!InvokeKernel(f.cx, args))
|
||||
THROW();
|
||||
|
||||
return;
|
||||
|
@ -558,7 +558,7 @@ class SetPropCompiler : public PICStubCompiler
|
||||
return disable("can't have method barrier");
|
||||
|
||||
JSObject *funobj = &f.regs.sp[-1].toObject();
|
||||
if (funobj != GET_FUNCTION_PRIVATE(cx, funobj))
|
||||
if (funobj != funobj->getFunctionPrivate())
|
||||
return disable("mismatched function");
|
||||
|
||||
flags |= Shape::METHOD;
|
||||
|
@ -704,9 +704,9 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
|
||||
* a compound statement (not at the top statement level of global code, or
|
||||
* at the top level of a function body).
|
||||
*/
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JSObject *obj = fun;
|
||||
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
/*
|
||||
* Even a null closure needs a parent for principals finding.
|
||||
* FIXME: bug 476950, although debugger users may also demand some kind
|
||||
@ -1325,10 +1325,10 @@ stubs::DefLocalFun(VMFrame &f, JSFunction *fun)
|
||||
* activation.
|
||||
*/
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
JS_ASSERT(!FUN_FLAT_CLOSURE(fun));
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JS_ASSERT(!fun->isFlatClosure());
|
||||
JSObject *obj = fun;
|
||||
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
obj = CloneFunctionObject(f.cx, fun, &f.fp()->scopeChain());
|
||||
if (!obj)
|
||||
THROWV(NULL);
|
||||
@ -1381,8 +1381,8 @@ stubs::RegExp(VMFrame &f, JSObject *regex)
|
||||
JSObject * JS_FASTCALL
|
||||
stubs::LambdaForInit(VMFrame &f, JSFunction *fun)
|
||||
{
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
if (FUN_NULL_CLOSURE(fun) && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
JSObject *obj = fun;
|
||||
if (fun->isNullClosure() && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
fun->setMethodAtom(f.fp()->script()->getAtom(GET_SLOTNO(f.regs.pc)));
|
||||
return obj;
|
||||
}
|
||||
@ -1392,8 +1392,8 @@ stubs::LambdaForInit(VMFrame &f, JSFunction *fun)
|
||||
JSObject * JS_FASTCALL
|
||||
stubs::LambdaForSet(VMFrame &f, JSFunction *fun)
|
||||
{
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
if (FUN_NULL_CLOSURE(fun) && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
JSObject *obj = fun;
|
||||
if (fun->isNullClosure() && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
const Value &lref = f.regs.sp[-1];
|
||||
if (lref.isObject() && lref.toObject().canHaveMethodBarrier()) {
|
||||
fun->setMethodAtom(f.fp()->script()->getAtom(GET_SLOTNO(f.regs.pc)));
|
||||
@ -1406,8 +1406,8 @@ stubs::LambdaForSet(VMFrame &f, JSFunction *fun)
|
||||
JSObject * JS_FASTCALL
|
||||
stubs::LambdaJoinableForCall(VMFrame &f, JSFunction *fun)
|
||||
{
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
if (FUN_NULL_CLOSURE(fun) && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
JSObject *obj = fun;
|
||||
if (fun->isNullClosure() && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
/*
|
||||
* Array.prototype.sort and String.prototype.replace are
|
||||
* optimized as if they are special form. We know that they
|
||||
@ -1443,8 +1443,8 @@ stubs::LambdaJoinableForCall(VMFrame &f, JSFunction *fun)
|
||||
JSObject * JS_FASTCALL
|
||||
stubs::LambdaJoinableForNull(VMFrame &f, JSFunction *fun)
|
||||
{
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
if (FUN_NULL_CLOSURE(fun) && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
JSObject *obj = fun;
|
||||
if (fun->isNullClosure() && obj->getParent() == &f.fp()->scopeChain()) {
|
||||
jsbytecode *pc2 = f.regs.pc + JSOP_NULL_LENGTH;
|
||||
JSOp op2 = JSOp(*pc2);
|
||||
|
||||
@ -1457,10 +1457,10 @@ stubs::LambdaJoinableForNull(VMFrame &f, JSFunction *fun)
|
||||
JSObject * JS_FASTCALL
|
||||
stubs::Lambda(VMFrame &f, JSFunction *fun)
|
||||
{
|
||||
JSObject *obj = FUN_OBJECT(fun);
|
||||
JSObject *obj = fun;
|
||||
|
||||
JSObject *parent;
|
||||
if (FUN_NULL_CLOSURE(fun)) {
|
||||
if (fun->isNullClosure()) {
|
||||
parent = &f.fp()->scopeChain();
|
||||
} else {
|
||||
parent = GetScopeChainFast(f.cx, f.fp(), JSOP_LAMBDA, JSOP_LAMBDA_LENGTH);
|
||||
|
@ -1554,7 +1554,7 @@ ValueToScript(JSContext *cx, jsval v)
|
||||
} else if (clasp == Jsvalify(&js_GeneratorClass)) {
|
||||
JSGenerator *gen = (JSGenerator *) JS_GetPrivate(cx, obj);
|
||||
fun = gen->floatingFrame()->fun();
|
||||
script = FUN_SCRIPT(fun);
|
||||
script = fun->script();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1562,7 +1562,7 @@ ValueToScript(JSContext *cx, jsval v)
|
||||
fun = JS_ValueToFunction(cx, v);
|
||||
if (!fun)
|
||||
return NULL;
|
||||
script = FUN_SCRIPT(fun);
|
||||
script = fun->maybeScript();
|
||||
if (!script) {
|
||||
JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL,
|
||||
JSSMSG_SCRIPTS_ONLY);
|
||||
@ -1992,7 +1992,7 @@ DisassembleValue(JSContext *cx, jsval v, bool lines, bool recursive, Sprinter *s
|
||||
JSScript *script = ValueToScript(cx, v);
|
||||
if (!script)
|
||||
return false;
|
||||
if (VALUE_IS_FUNCTION(cx, v)) {
|
||||
if (!JSVAL_IS_PRIMITIVE(v) && JSVAL_TO_OBJECT(v)->isFunction()) {
|
||||
JSFunction *fun = JS_ValueToFunction(cx, v);
|
||||
if (fun && (fun->flags & ~7U)) {
|
||||
uint16 flags = fun->flags;
|
||||
@ -2007,10 +2007,10 @@ DisassembleValue(JSContext *cx, jsval v, bool lines, bool recursive, Sprinter *s
|
||||
|
||||
#undef SHOW_FLAG
|
||||
|
||||
if (FUN_INTERPRETED(fun)) {
|
||||
if (FUN_NULL_CLOSURE(fun))
|
||||
if (fun->isInterpreted()) {
|
||||
if (fun->isNullClosure())
|
||||
Sprint(sp, " NULL_CLOSURE");
|
||||
else if (FUN_FLAT_CLOSURE(fun))
|
||||
else if (fun->isFlatClosure())
|
||||
Sprint(sp, " FLAT_CLOSURE");
|
||||
|
||||
JSScript *script = fun->script();
|
||||
@ -2698,7 +2698,7 @@ Clone(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_FALSE;
|
||||
argv[0] = OBJECT_TO_JSVAL(obj);
|
||||
}
|
||||
if (VALUE_IS_FUNCTION(cx, argv[0])) {
|
||||
if (!JSVAL_IS_PRIMITIVE(argv[0]) && JSVAL_TO_OBJECT(argv[0])->isFunction()) {
|
||||
funobj = JSVAL_TO_OBJECT(argv[0]);
|
||||
} else {
|
||||
JSFunction *fun = JS_ValueToFunction(cx, argv[0]);
|
||||
|
@ -0,0 +1,24 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
var r1 = [0, 1, 2, 3];
|
||||
Object.defineProperty(r1, (1 << 23) - 1, {});
|
||||
JSON.stringify({ 0: 0, 1: 1, 2: 2, 3: 3 }, r1)
|
||||
|
||||
var r2 = [0, 1, 2, 3];
|
||||
Object.defineProperty(r2, (1 << 30), {});
|
||||
try
|
||||
{
|
||||
JSON.stringify({ 0: 0, 1: 1, 2: 2, 3: 3 }, r2)
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
assertEq(""+e, "InternalError: allocation size overflow");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
@ -16,6 +16,7 @@ script extension-methods-reject-null-undefined-this.js
|
||||
skip-if(!xulRuntime.shell) script function-definition-with.js # needs evaluate()
|
||||
script function-properties.js
|
||||
script iterator-in-catch.js
|
||||
script JSON-string-replacer-overflow.js
|
||||
skip-if(!xulRuntime.shell) script legacy-JSON.js # needs parseLegacyJSON
|
||||
fails script nested-delete-name-in-evalcode.js # bug 604301, at a minimum
|
||||
script proxy-strict.js
|
||||
|
@ -520,7 +520,7 @@ Debugger::handleUncaughtException(AutoCompartment &ac, Value *vp, bool callHook)
|
||||
Value exc = cx->getPendingException();
|
||||
Value rv;
|
||||
cx->clearPendingException();
|
||||
if (ExternalInvoke(cx, ObjectValue(*object), fval, 1, &exc, &rv))
|
||||
if (Invoke(cx, ObjectValue(*object), fval, 1, &exc, &rv))
|
||||
return vp ? parseResumptionValue(ac, true, rv, vp, false) : JSTRAP_CONTINUE;
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ CallMethodIfPresent(JSContext *cx, JSObject *obj, const char *name, int argc, Va
|
||||
return atom &&
|
||||
js_GetMethod(cx, obj, ATOM_TO_JSID(atom), JSGET_NO_METHOD_BARRIER, &fval) &&
|
||||
(!js_IsCallable(fval) ||
|
||||
ExternalInvoke(cx, ObjectValue(*obj), fval, argc, argv, rval));
|
||||
Invoke(cx, ObjectValue(*obj), fval, argc, argv, rval));
|
||||
}
|
||||
|
||||
JSTrapStatus
|
||||
@ -647,7 +647,7 @@ Debugger::fireDebuggerStatement(JSContext *cx, Value *vp)
|
||||
return handleUncaughtException(ac, vp, false);
|
||||
|
||||
Value rv;
|
||||
bool ok = ExternalInvoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv);
|
||||
bool ok = Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv);
|
||||
return parseResumptionValue(ac, ok, rv, vp);
|
||||
}
|
||||
|
||||
@ -672,7 +672,7 @@ Debugger::fireExceptionUnwind(JSContext *cx, Value *vp)
|
||||
return handleUncaughtException(ac, vp, false);
|
||||
|
||||
Value rv;
|
||||
bool ok = ExternalInvoke(cx, ObjectValue(*object), ObjectValue(*hook), 2, argv, &rv);
|
||||
bool ok = Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 2, argv, &rv);
|
||||
JSTrapStatus st = parseResumptionValue(ac, ok, rv, vp);
|
||||
if (st == JSTRAP_CONTINUE)
|
||||
cx->setPendingException(exc);
|
||||
@ -697,7 +697,7 @@ Debugger::fireEnterFrame(JSContext *cx)
|
||||
return;
|
||||
}
|
||||
Value rv;
|
||||
if (!ExternalInvoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv))
|
||||
if (!Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv))
|
||||
handleUncaughtException(ac, NULL, true);
|
||||
}
|
||||
|
||||
@ -722,7 +722,7 @@ Debugger::fireNewScript(JSContext *cx, JSScript *script, JSObject *obj, NewScrip
|
||||
Value argv[1];
|
||||
argv[0].setObject(*dsobj);
|
||||
Value rv;
|
||||
if (!ExternalInvoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv))
|
||||
if (!Invoke(cx, ObjectValue(*object), ObjectValue(*hook), 1, argv, &rv))
|
||||
handleUncaughtException(ac, NULL, true);
|
||||
}
|
||||
|
||||
@ -2658,6 +2658,10 @@ EvaluateInScope(JSContext *cx, JSObject *scobj, StackFrame *fp, const jschar *ch
|
||||
{
|
||||
assertSameCompartment(cx, scobj, fp);
|
||||
|
||||
/* Execute assumes an already-computed 'this" value. */
|
||||
if (!ComputeThis(cx, fp))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* NB: This function breaks the assumption that the compiler can see all
|
||||
* calls and properly compute a static level. In order to get around this,
|
||||
@ -2672,7 +2676,7 @@ EvaluateInScope(JSContext *cx, JSObject *scobj, StackFrame *fp, const jschar *ch
|
||||
if (!script)
|
||||
return false;
|
||||
|
||||
bool ok = Execute(cx, script, *scobj, fp->thisValue(), EXECUTE_DEBUG, fp, rval);
|
||||
bool ok = ExecuteKernel(cx, script, *scobj, fp->thisValue(), EXECUTE_DEBUG, fp, rval);
|
||||
js_DestroyScript(cx, script, 6);
|
||||
return ok;
|
||||
}
|
||||
@ -3003,6 +3007,7 @@ DebuggerObject_getOwnPropertyDescriptor(JSContext *cx, uintN argc, Value *vp)
|
||||
if (!ac.enter() || !cx->compartment->wrapId(cx, &id))
|
||||
return false;
|
||||
|
||||
ErrorCopier ec(ac, dbg->toJSObject());
|
||||
if (!GetOwnPropertyDescriptor(cx, obj, id, &desc))
|
||||
return false;
|
||||
}
|
||||
@ -3039,6 +3044,7 @@ DebuggerObject_getOwnPropertyNames(JSContext *cx, uintN argc, Value *vp)
|
||||
if (!ac.enter())
|
||||
return false;
|
||||
|
||||
ErrorCopier ec(ac, dbg->toJSObject());
|
||||
if (!GetPropertyNames(cx, obj, JSITER_OWNONLY | JSITER_HIDDEN, &keys))
|
||||
return false;
|
||||
}
|
||||
@ -3377,7 +3383,7 @@ ApplyOrCall(JSContext *cx, uintN argc, Value *vp, ApplyOrCallMode mode)
|
||||
* compartment and populate args.rval().
|
||||
*/
|
||||
Value rval;
|
||||
bool ok = ExternalInvoke(cx, thisv, calleev, callArgc, callArgv, &rval);
|
||||
bool ok = Invoke(cx, thisv, calleev, callArgc, callArgv, &rval);
|
||||
return dbg->newCompletionValue(ac, ok, rval, &args.rval());
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ GlobalObject::createConstructor(JSContext *cx, Native ctor, Class *clasp, JSAtom
|
||||
* Remember the class this function is a constructor for so that we know to
|
||||
* create an object of this class when we call the constructor.
|
||||
*/
|
||||
FUN_CLASP(fun) = clasp;
|
||||
fun->setConstructorClass(clasp);
|
||||
return fun;
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,13 @@ CallArgsFromSp(uintN argc, Value *sp)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* For calls to natives, the InvokeArgsGuard object provides a record of the
|
||||
* call for the debugger's callstack. For this to work, the InvokeArgsGuard
|
||||
* record needs to know when the call is actually active (because the
|
||||
* InvokeArgsGuard can be pushed long before and popped long after the actual
|
||||
* call, during which time many stack-observing things can happen).
|
||||
*/
|
||||
class CallArgsList : public CallArgs
|
||||
{
|
||||
friend class StackSegment;
|
||||
|
@ -1576,7 +1576,7 @@ XPC_WN_CallMethod(JSContext *cx, uintN argc, jsval *vp)
|
||||
|
||||
#ifdef DEBUG_slimwrappers
|
||||
{
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
JSFunction* fun = funobj->getFunctionPrivate();
|
||||
JSString *funid = JS_GetFunctionId(fun);
|
||||
JSAutoByteString bytes;
|
||||
const char *funname = !funid ? "" : bytes.encode(cx, funid) ? bytes.ptr() : "<error>";
|
||||
@ -1615,7 +1615,7 @@ XPC_WN_GetterSetter(JSContext *cx, uintN argc, jsval *vp)
|
||||
JSAutoByteString bytes;
|
||||
if(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION)
|
||||
{
|
||||
JSString *funid = JS_GetFunctionId(GET_FUNCTION_PRIVATE(cx, funobj));
|
||||
JSString *funid = JS_GetFunctionId(funobj->getFunctionPrivate());
|
||||
funname = !funid ? "" : bytes.encode(cx, funid) ? bytes.ptr() : "<error>";
|
||||
}
|
||||
SLIM_LOG_WILL_MORPH_FOR_PROP(cx, obj, funname);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user