Merge mozilla-central into mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2011-06-22 20:19:47 -04:00
commit f742585a1f
35 changed files with 328 additions and 113 deletions

View File

@ -661,8 +661,9 @@ var InspectorUI = {
this.win.document.removeEventListener("scroll", this, false);
this.win.removeEventListener("resize", this, false);
this.stopInspecting();
if (this.highlighter && this.highlighter.isHighlighting) {
if (this.highlighter) {
this.highlighter.unhighlight();
this.highlighter = null;
}
if (this.treePanelDiv) {

View File

@ -1178,7 +1178,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
let targetIndex = xulTab._tPos;
$icon.remove();
$icon.remove({ preserveEventHandlers: true });
if (targetIndex < (length - 1))
self.$appTabTray[0].insertBefore(
icon,

View File

@ -336,7 +336,9 @@ iQClass.prototype = {
// ----------
// Function: remove
// Removes the receiver from the DOM.
remove: function iQClass_remove() {
remove: function iQClass_remove(options) {
if (!options || !options.preserveEventHandlers)
this.unbindAll();
for (let i = 0; this[i] != null; i++) {
let elem = this[i];
if (elem.parentNode) {
@ -353,6 +355,7 @@ iQClass.prototype = {
for (let i = 0; this[i] != null; i++) {
let elem = this[i];
while (elem.firstChild) {
iQ(elem.firstChild).unbindAll();
elem.removeChild(elem.firstChild);
}
}
@ -746,6 +749,28 @@ iQClass.prototype = {
elem.removeEventListener(type, handler, false);
}
return this;
},
// ----------
// Function: unbindAll
// Unbinds all event handlers.
unbindAll: function iQClass_unbindAll() {
for (let i = 0; this[i] != null; i++) {
let elem = this[i];
for (let j = 0; j < elem.childElementCount; j++)
iQ(elem.children[j]).unbindAll();
if (!elem.iQEventData)
continue;
for (let type in elem.iQEventData) {
while (elem.iQEventData[type].length)
this.unbind(type, elem.iQEventData[type][0].original);
}
}
return this;
}
};

View File

@ -105,7 +105,7 @@ function performTestComparisons(evt)
function finishUp() {
Services.obs.removeObserver(finishUp, "inspector-closed", false);
ok(!InspectorUI.highlighter.isHighlighting, "panel is not highlighting");
ok(!InspectorUI.highlighter, "panel is not highlighting");
doc = h1 = null;
gBrowser.removeCurrentTab();
finish();

View File

@ -53,7 +53,7 @@ interface nsIDOMBlob;
#include "jsapi.h"
%}
[scriptable, uuid(dea238a1-240f-45f4-9f07-7769bc69eb76)]
[scriptable, builtinclass, uuid(dea238a1-240f-45f4-9f07-7769bc69eb76)]
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
// event handler attributes
attribute nsIDOMEventListener onabort;
@ -64,7 +64,7 @@ interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
attribute nsIDOMEventListener onloadend;
};
[scriptable, uuid(09ff3682-7759-4441-a765-f70e1a1fabcf)]
[scriptable, builtinclass, uuid(09ff3682-7759-4441-a765-f70e1a1fabcf)]
interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
// for future use
};

View File

@ -402,6 +402,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager)
tmp->mWrapperTable.ops = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mAttachedStack)
if (tmp->mProcessAttachedQueueEvent) {
tmp->mProcessAttachedQueueEvent->Revoke();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

View File

@ -314,7 +314,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLBinding)
tmp->mContent);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContent)
// XXX What about mNextBinding and mInsertionPointTable?
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNextBinding)
delete tmp->mInsertionPointTable;
tmp->mInsertionPointTable = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsXBLBinding)
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObjectOwner*>(

View File

@ -6816,6 +6816,57 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
return NS_OK;
}
if (id == sLocation_id) {
// This must be done even if we're just getting the value of
// window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING
// here) since we must define window.location to prevent the
// getter from being overriden (for security reasons).
// Note: Because we explicitly don't forward to the inner window
// above, we have to ensure here that our window has a current
// inner window so that the location object we return will work.
if (win->IsOuterWindow()) {
win->EnsureInnerWindow();
}
nsCOMPtr<nsIDOMLocation> location;
rv = win->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv);
// Make sure we wrap the location object in the inner window's
// scope if we've got an inner window.
JSObject *scope = nsnull;
if (win->IsOuterWindow()) {
nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal();
if (innerWin) {
scope = innerWin->GetGlobalJSObject();
}
}
if (!scope) {
wrapper->GetJSObject(&scope);
}
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
jsval v;
rv = WrapNative(cx, scope, location, &NS_GET_IID(nsIDOMLocation), PR_TRUE,
&v, getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);
JSBool ok = JS_WrapValue(cx, &v) &&
JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
JSPROP_PERMANENT | JSPROP_ENUMERATE);
if (!ok) {
return NS_ERROR_FAILURE;
}
*objp = obj;
return NS_OK;
}
// Hmm, we do an awful lot of QIs here; maybe we should add a
// method on an interface that would let us just call into the
@ -6923,58 +6974,6 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
return NS_OK;
}
if (id == sLocation_id) {
// This must be done even if we're just getting the value of
// window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING
// here) since we must define window.location to prevent the
// getter from being overriden (for security reasons).
// Note: Because we explicitly don't forward to the inner window
// above, we have to ensure here that our window has a current
// inner window so that the location object we return will work.
if (win->IsOuterWindow()) {
win->EnsureInnerWindow();
}
nsCOMPtr<nsIDOMLocation> location;
rv = win->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv);
// Make sure we wrap the location object in the inner window's
// scope if we've got an inner window.
JSObject *scope = nsnull;
if (win->IsOuterWindow()) {
nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal();
if (innerWin) {
scope = innerWin->GetGlobalJSObject();
}
}
if (!scope) {
wrapper->GetJSObject(&scope);
}
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
jsval v;
rv = WrapNative(cx, scope, location, &NS_GET_IID(nsIDOMLocation), PR_TRUE,
&v, getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);
JSBool ok = JS_WrapValue(cx, &v) &&
JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
JSPROP_PERMANENT | JSPROP_ENUMERATE);
if (!ok) {
return NS_ERROR_FAILURE;
}
*objp = obj;
return NS_OK;
}
if (id == sOnhashchange_id) {
// Special handling so |"onhashchange" in window| returns true
if (!JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,

View File

@ -47,7 +47,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(1c773b30-d1cf-11d2-bd95-00805f8ae3f4)]
[scriptable, builtinclass, uuid(1c773b30-d1cf-11d2-bd95-00805f8ae3f4)]
interface nsIDOMEventTarget : nsISupports
{
/**

View File

@ -128,13 +128,13 @@ interface nsIWorkerScope : nsIWorkerGlobalScope
attribute nsIDOMEventListener onclose;
};
[scriptable, uuid(b90b7561-b5e2-4545-84b0-280dbaaa94ea)]
[scriptable, builtinclass, uuid(b90b7561-b5e2-4545-84b0-280dbaaa94ea)]
interface nsIAbstractWorker : nsIDOMEventTarget
{
attribute nsIDOMEventListener onerror;
};
[scriptable, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)]
[scriptable, builtinclass, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)]
interface nsIWorker : nsIAbstractWorker
{
void postMessage(/* in JSObject aMessage */);

View File

@ -271,6 +271,32 @@ gfxGDIFont::SetupCairoFont(gfxContext *aContext)
return PR_TRUE;
}
gfxFont::RunMetrics
gfxGDIFont::Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aRefContext,
Spacing *aSpacing)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext, aSpacing);
// if aBoundingBoxType is LOOSE_INK_EXTENTS
// and the underlying cairo font may be antialiased,
// we can't trust Windows to have considered all the pixels
// so we need to add "padding" to the bounds.
// (see bugs 475968, 439831, compare also bug 445087)
if (aBoundingBoxType == LOOSE_INK_EXTENTS &&
mAntialiasOption != kAntialiasNone &&
metrics.mBoundingBox.width > 0) {
metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit();
metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 3;
}
return metrics;
}
void
gfxGDIFont::Initialize()
{

View File

@ -73,6 +73,13 @@ public:
virtual PRBool SetupCairoFont(gfxContext *aContext);
/* override Measure to add padding for antialiasing */
virtual RunMetrics Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing);
/* required for MathML to suppress effects of ClearType "padding" */
virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption);

View File

@ -194,6 +194,28 @@ gfxMacFont::SetupCairoFont(gfxContext *aContext)
return PR_TRUE;
}
gfxFont::RunMetrics
gfxMacFont::Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aRefContext,
Spacing *aSpacing)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext, aSpacing);
// if aBoundingBoxType is not TIGHT_HINTED_OUTLINE_EXTENTS then we need to add
// a pixel column each side of the bounding box in case of antialiasing "bleed"
if (aBoundingBoxType != TIGHT_HINTED_OUTLINE_EXTENTS &&
metrics.mBoundingBox.width > 0) {
metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit();
metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 2;
}
return metrics;
}
void
gfxMacFont::InitMetrics()
{

View File

@ -68,6 +68,13 @@ public:
virtual PRBool SetupCairoFont(gfxContext *aContext);
/* override Measure to add padding for antialiasing */
virtual RunMetrics Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing);
// override gfxFont table access function to bypass gfxFontEntry cache,
// use CGFontRef API to get direct access to system font data
virtual hb_blob_t *GetFontTable(PRUint32 aTag);

View File

@ -166,8 +166,9 @@ nsXPCWrappedJSClass::GetNewOrUsed(XPCCallContext& ccx, REFNSIID aIID,
ccx.GetXPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
if(info)
{
PRBool canScript;
PRBool canScript, isBuiltin;
if(NS_SUCCEEDED(info->IsScriptable(&canScript)) && canScript &&
NS_SUCCEEDED(info->IsBuiltinClass(&isBuiltin)) && !isBuiltin &&
nsXPConnect::IsISupportsDescendant(info))
{
clazz = new nsXPCWrappedJSClass(ccx, aIID, info);
@ -295,8 +296,9 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(XPCCallContext& ccx,
ccx.GetXPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
if(!info)
return nsnull;
PRBool canScript;
if(NS_FAILED(info->IsScriptable(&canScript)) || !canScript)
PRBool canScript, isBuiltin;
if(NS_FAILED(info->IsScriptable(&canScript)) || !canScript ||
NS_FAILED(info->IsBuiltinClass(&isBuiltin)) || isBuiltin)
return nsnull;
}

View File

@ -89,6 +89,7 @@ _TEST_FILES = bug500931_helper.html \
test2_bug629331.html \
test_bug618017.html \
test_bug636097.html \
test_bug661980.html \
test_bug650273.html \
file_bug650273.html \
file_bug658560.html \

View File

@ -0,0 +1,62 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=661980
-->
<head>
<title>Test for Bug 661980</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=661980">Mozilla Bug 661980</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 661980 **/
// While not currently needed, make this as similar as possible to a real
// EventTarget just to make sure that we're tripping on the wrapping and
// nothing else.
var fakeTarget = {
addEventListener: function() {},
removeEventListener: function() {},
dispatchEvent: function() {}
}
var mouseevent = document.createEvent("MouseEvent");
var didThrow = false;
dump("hello nurse");
try {
mouseevent.initMouseEvent("mouseover",
false, false,
window,
1, 2, 3, 4, 5,
false, false, false, false,
0,
fakeTarget);
}
catch (ex) {
didThrow = true;
}
ok(didThrow, "should not be able to implement EventTarget using script");
mouseevent.initMouseEvent("mouseout",
false, false,
window,
1, 2, 3, 4, 5,
false, false, false, false,
0,
document.body);
is(mouseevent.type, "mouseout",
"should able to implement EventTarget using Element");
</script>
</pre>
</body>
</html>

View File

@ -123,10 +123,10 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498
== foreignObject-start-hidden-01.svg pass.svg # followup from Bug 596765
== foreignObject-start-hidden-02.svg pass.svg
== getElementById-a-element-01.svg pass.svg
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01a.svg gradient-live-01-ref.svg # bug 623403
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01b.svg gradient-live-01-ref.svg # bug 623403
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01c.svg gradient-live-01-ref.svg # bug 623403
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == gradient-live-01d.svg gradient-live-01-ref.svg # bug 623403
== gradient-live-01a.svg gradient-live-01-ref.svg
== gradient-live-01b.svg gradient-live-01-ref.svg
== gradient-live-01c.svg gradient-live-01-ref.svg
== gradient-live-01d.svg gradient-live-01-ref.svg
fails == inline-in-xul-basic-01.xul pass.svg
== invalid-text-01.svg pass.svg
== linearGradient-basic-01.svg pass.svg

View File

@ -2138,7 +2138,11 @@ Checker.prototype = {
cleanUpUpdatesDir();
this._request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
createInstance(Ci.nsISupports);
// This is here to let unit test code override XHR
if (this._request.wrappedJSObject) {
this._request = this._request.wrappedJSObject;
}
this._request.open("GET", url, true);
var allowNonBuiltIn = !getPref("getBoolPref",
PREF_APP_UPDATE_CERT_REQUIREBUILTIN, true);

View File

@ -970,6 +970,11 @@ function overrideXHR(callback) {
* Bare bones XMLHttpRequest implementation for testing onprogress, onerror,
* and onload nsIDomEventListener handleEvent.
*/
function makeHandler(val) {
if (typeof val == "function")
return ({ handleEvent: val });
return val;
}
function xhr() {
}
xhr.prototype = {
@ -989,20 +994,19 @@ xhr.prototype = {
do_execute_soon(gXHRCallback); // Use a timeout so the XHR completes
},
_onprogress: null,
set onprogress(val) { gXHR._onprogress = val; },
set onprogress(val) { gXHR._onprogress = makeHandler(val); },
get onprogress() { return gXHR._onprogress; },
_onerror: null,
set onerror(val) { gXHR._onerror = val; },
set onerror(val) { gXHR._onerror = makeHandler(val); },
get onerror() { return gXHR._onerror; },
_onload: null,
set onload(val) { gXHR._onload = val; },
set onload(val) { gXHR._onload = makeHandler(val); },
get onload() { return gXHR._onload; },
flags: AUS_Ci.nsIClassInfo.SINGLETON,
implementationLanguage: AUS_Ci.nsIProgrammingLanguage.JAVASCRIPT,
getHelperForLanguage: function(language) null,
getInterfaces: function(count) {
var interfaces = [AUS_Ci.nsIXMLHttpRequest, AUS_Ci.nsIJSXMLHttpRequest,
AUS_Ci.nsIXMLHttpRequestEventTarget];
var interfaces = [AUS_Ci.nsISupports];
count.value = interfaces.length;
return interfaces;
},
@ -1015,14 +1019,12 @@ xhr.prototype = {
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIXMLHttpRequest) ||
aIID.equals(AUS_Ci.nsIJSXMLHttpRequest) ||
aIID.equals(AUS_Ci.nsIXMLHttpRequestEventTarget) ||
aIID.equals(AUS_Ci.nsIClassInfo) ||
if (aIID.equals(AUS_Ci.nsIClassInfo) ||
aIID.equals(AUS_Ci.nsISupports))
return gXHR;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
},
get wrappedJSObject() { return this; }
};
/* Update check listener */

View File

@ -353,9 +353,7 @@ GfxInfo::Init()
setupGetDeviceRegistryProperty &&
setupDestroyDeviceInfoList) {
/* create a device information set composed of the current display device */
HDEVINFO devinfo = setupGetClassDevs(NULL,
PromiseFlatString(mDeviceID).get(),
NULL,
HDEVINFO devinfo = setupGetClassDevs(NULL, mDeviceID.get(), NULL,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
if (devinfo != INVALID_HANDLE_VALUE) {

View File

@ -274,8 +274,10 @@ int nsWindow::sTrimOnMinimize = 2;
PRBool nsWindow::sDefaultTrackPointHack = PR_FALSE;
// Default value for general window class (used when the pref is the empty string).
const char* nsWindow::sDefaultMainWindowClass = kClassNameGeneral;
// Whether to enable the Elantech gesture hack.
PRBool nsWindow::sUseElantechGestureHacks = PR_FALSE;
// Whether to enable the Elantech swipe gesture hack.
PRBool nsWindow::sUseElantechSwipeHack = PR_FALSE;
// Whether to enable the Elantech pinch-to-zoom gesture hack.
PRBool nsWindow::sUseElantechPinchHack = PR_FALSE;
// If we're using D3D9, this will not be allowed during initial 5 seconds.
bool nsWindow::sAllowD3D9 = false;
@ -6651,7 +6653,7 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
aMsg.wParam != VK_PROCESSKEY ? aMsg.wParam : ::ImmGetVirtualKey(mWnd);
gKbdLayout.OnKeyDown(virtualKeyCode);
if (sUseElantechGestureHacks) {
if (sUseElantechSwipeHack) {
PerformElantechSwipeGestureHack(virtualKeyCode, aModKeyState);
}
@ -6994,9 +6996,11 @@ LRESULT nsWindow::OnKeyUp(const MSG &aMsg,
{
UINT virtualKeyCode = aMsg.wParam;
if (sUseElantechGestureHacks) {
if (sUseElantechSwipeHack) {
PerformElantechSwipeGestureHack(virtualKeyCode, aModKeyState);
}
if (sUseElantechPinchHack) {
// Version 8 of the Elantech touchpad driver sends these messages for
// zoom gestures:
//
@ -7609,7 +7613,7 @@ PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
// is another app's window or no window under the
// pointer.
if (sUseElantechGestureHacks && IsElantechHelperWindow(destWnd)) {
if (sUseElantechPinchHack && IsElantechHelperWindow(destWnd)) {
// The Elantech driver places a window right underneath the cursor
// when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom
// gesture. We detect that here, and search for our window that would
@ -8883,8 +8887,8 @@ IsObsoleteSynapticsDriver()
return majorVersion < 15;
}
static PRBool
IsObsoleteElantechDriver()
static PRInt32
GetElantechDriverMajorVersion()
{
PRUnichar buf[40];
// The driver version is found in one of these two registry keys.
@ -8907,18 +8911,17 @@ IsObsoleteElantechDriver()
// or at the start of the string.
for (PRUnichar* p = buf; *p; p++) {
if (*p >= L'0' && *p <= L'9' && (p == buf || *(p - 1) == L' ')) {
int majorVersion = wcstol(p, NULL, 10);
// Versions 7 and 8 need the hack.
if (majorVersion == 7 || majorVersion == 8)
return PR_TRUE;
return wcstol(p, NULL, 10);
}
}
return PR_FALSE;
return 0;
}
void nsWindow::InitInputWorkaroundPrefDefaults()
{
PRUint32 elantechDriverVersion = GetElantechDriverMajorVersion();
if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\TrackPoint")) {
sDefaultTrackPointHack = PR_TRUE;
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\UltraNav")) {
@ -8927,13 +8930,15 @@ void nsWindow::InitInputWorkaroundPrefDefaults()
sDefaultTrackPointHack = PR_TRUE;
} else if ((HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB") ||
HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) &&
IsObsoleteSynapticsDriver()) {
elantechDriverVersion != 0 && elantechDriverVersion <= 8) {
sDefaultTrackPointHack = PR_TRUE;
}
sUseElantechGestureHacks =
PRBool useElantechGestureHacks =
GetInputWorkaroundPref("ui.elantech_gesture_hacks.enabled",
IsObsoleteElantechDriver());
elantechDriverVersion != 0);
sUseElantechSwipeHack = useElantechGestureHacks && elantechDriverVersion <= 7;
sUseElantechPinchHack = useElantechGestureHacks && elantechDriverVersion <= 8;
}
LPARAM nsWindow::lParamToScreen(LPARAM lParam)

View File

@ -526,7 +526,8 @@ protected:
static int sTrimOnMinimize;
static PRBool sDefaultTrackPointHack;
static const char* sDefaultMainWindowClass;
static PRBool sUseElantechGestureHacks;
static PRBool sUseElantechSwipeHack;
static PRBool sUseElantechPinchHack;
static bool sAllowD3D9;
// Always use the helper method to read this property. See bug 603793.

View File

@ -122,7 +122,7 @@ ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
{
int a, b, c, d;
/* honestly, why do I even bother */
if (sscanf(nsPromiseFlatCString(NS_LossyConvertUTF16toASCII(aVersion)).get(),
if (sscanf(NS_LossyConvertUTF16toASCII(aVersion).get(),
"%d.%d.%d.%d", &a, &b, &c, &d) != 4)
return false;
if (a < 0 || a > 0xffff) return false;

View File

@ -665,7 +665,7 @@ NS_IMETHODIMP GfxInfoBase::GetFailures(PRUint32 *failureCount NS_OUTPARAM, char
/* copy over the failure messages into the array we just allocated */
for (PRUint32 i = 0; i < *failureCount; i++) {
nsPromiseFlatCString flattenedFailureMessage(mFailures[i]);
nsCString& flattenedFailureMessage(mFailures[i]);
(*failures)[i] = (char*)nsMemory::Clone(flattenedFailureMessage.get(), flattenedFailureMessage.Length() + 1);
if (!(*failures)[i]) {

View File

@ -49,7 +49,7 @@
* pointer identity.
*/
[scriptable, uuid(1f341018-521a-49de-b806-1bef5c9a00b0)]
[scriptable, builtinclass, uuid(1f341018-521a-49de-b806-1bef5c9a00b0)]
interface nsIAtom : nsISupports
{
/**

View File

@ -549,6 +549,7 @@ class Interface(object):
class InterfaceAttributes(object):
uuid = None
scriptable = False
builtinclass = False
function = False
deprecated = False
noscript = False
@ -565,12 +566,16 @@ class InterfaceAttributes(object):
def setnoscript(self):
self.noscript = True
def setbuiltinclass(self):
self.builtinclass = True
def setdeprecated(self):
self.deprecated = True
actions = {
'uuid': (True, setuuid),
'scriptable': (False, setscriptable),
'builtinclass': (False, setbuiltinclass),
'function': (False, setfunction),
'noscript': (False, setnoscript),
'deprecated': (False, setdeprecated),
@ -605,6 +610,8 @@ class InterfaceAttributes(object):
l.append("\tuuid: %s\n" % self.uuid)
if self.scriptable:
l.append("\tscriptable\n")
if self.builtinclass:
l.append("\tbuiltinclass\n")
if self.function:
l.append("\tfunction\n")
return "".join(l)

View File

@ -76,7 +76,7 @@ NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_INITIALIZED);
xptiInterfaceEntry *iie = iim->GetInterfaceEntryForIID(&aIID);
if (!iie || !iie->EnsureResolved())
if (!iie || !iie->EnsureResolved() || iie->GetBuiltinClassFlag())
return NS_ERROR_FAILURE;
nsXPTCStubBase* newbase = new nsXPTCStubBase(aOuter, iie);

View File

@ -58,13 +58,14 @@ class nsXPTType;
%}
/* this is NOT intended to be scriptable */
[uuid(215DBE04-94A7-11d2-BA58-00805F8A5DD7)]
[uuid(7de126a2-ef4b-4e3b-a952-78ce4c133e38)]
interface nsIInterfaceInfo : nsISupports
{
readonly attribute string name;
readonly attribute nsIIDPtr InterfaceIID;
PRBool isScriptable();
PRBool isBuiltinClass();
readonly attribute nsIInterfaceInfo parent;

View File

@ -273,6 +273,7 @@ xptiInterfaceInfoManager::VerifyAndAddEntryIfNew(XPTInterfaceDirectoryEntry* ifa
//XXX We should SetHeader too as part of the validation, no?
entry->SetScriptableFlag(XPT_ID_IS_SCRIPTABLE(iface->interface_descriptor->flags));
entry->SetBuiltinClassFlag(XPT_ID_IS_BUILTINCLASS(iface->interface_descriptor->flags));
mWorkingSet.mIIDTable.Put(entry->IID(), entry);
mWorkingSet.mNameTable.Put(entry->GetTheName(), entry);

View File

@ -250,7 +250,7 @@ public:
};
// Additional bit flags...
enum {SCRIPTABLE = 4};
enum {SCRIPTABLE = 4, BUILTINCLASS = 8};
PRUint8 GetResolveState() const {return mFlags.GetState();}
@ -261,6 +261,10 @@ public:
{mFlags.SetFlagBit(PRUint8(SCRIPTABLE),on);}
PRBool GetScriptableFlag() const
{return mFlags.GetFlagBit(PRUint8(SCRIPTABLE));}
void SetBuiltinClassFlag(PRBool on)
{mFlags.SetFlagBit(PRUint8(BUILTINCLASS),on);}
PRBool GetBuiltinClassFlag() const
{return mFlags.GetFlagBit(PRUint8(BUILTINCLASS));}
const nsID* GetTheIID() const {return &mIID;}
const char* GetTheName() const {return mName;}
@ -288,6 +292,10 @@ public:
nsresult GetName(char * *aName);
nsresult GetIID(nsIID * *aIID);
nsresult IsScriptable(PRBool *_retval);
nsresult IsBuiltinClass(PRBool *_retval) {
*_retval = GetBuiltinClassFlag();
return NS_OK;
}
// Except this one.
//nsresult GetParent(nsIInterfaceInfo * *aParent);
nsresult GetMethodCount(PRUint16 *aMethodCount);
@ -363,6 +371,7 @@ public:
NS_IMETHOD GetName(char * *aName) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); }
NS_IMETHOD GetInterfaceIID(nsIID * *aIID) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIID(aIID); }
NS_IMETHOD IsScriptable(PRBool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsScriptable(_retval); }
NS_IMETHOD IsBuiltinClass(PRBool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsBuiltinClass(_retval); }
// Except this one.
NS_IMETHOD GetParent(nsIInterfaceInfo * *aParent)
{

View File

@ -520,6 +520,9 @@ typelib_interface(TreeState *state)
if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "function"))
interface_flags |= XPT_ID_FUNCTION;
if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "builtinclass"))
interface_flags |= XPT_ID_BUILTINCLASS;
ide = FindInterfaceByName(HEADER(state)->interface_directory,
HEADER(state)->num_interfaces, name);
if (!ide) {

View File

@ -885,23 +885,40 @@ xpidl_list_foreach(IDL_tree p, IDL_tree_func foreach, gpointer user_data)
gboolean
verify_interface_declaration(IDL_tree interface_tree)
{
gboolean scriptable =
IDL_tree_property_get(IDL_INTERFACE(interface_tree).ident,
"scriptable") != NULL;
gboolean builtinclass =
IDL_tree_property_get(IDL_INTERFACE(interface_tree).ident,
"builtinclass") != NULL;
IDL_tree iter;
/*
* If we have the scriptable attribute then make sure all of our direct
* parents have it as well.
* NOTE: We don't recurse since all interfaces will fall through here
* NOTE: We don't recurse since all interfaces will come through here
*/
if (IDL_tree_property_get(IDL_INTERFACE(interface_tree).ident,
"scriptable")) {
if (scriptable || !builtinclass) {
for (iter = IDL_INTERFACE(interface_tree).inheritance_spec; iter;
iter = IDL_LIST(iter).next) {
if (IDL_tree_property_get(
IDL_INTERFACE(iter).ident, "scriptable") == 0) {
if (scriptable &&
IDL_tree_property_get(
IDL_INTERFACE(iter).ident, "scriptable") == 0) {
XPIDL_WARNING((interface_tree,IDL_WARNING1,
"%s is scriptable but inherits from the non-scriptable interface %s\n",
IDL_IDENT(IDL_INTERFACE(interface_tree).ident).str,
IDL_IDENT(IDL_INTERFACE(iter).ident).str));
}
if (!builtinclass &&
IDL_tree_property_get(
IDL_INTERFACE(iter).ident, "builtinclass")) {
IDL_tree_error(interface_tree,
"%s is not [builtinclass] but extends "
"[builtinclass] interface %s",
IDL_IDENT(IDL_INTERFACE(interface_tree).ident).str,
IDL_IDENT(IDL_INTERFACE(iter).ident).str);
return FALSE;
}
}
}
return TRUE;

View File

@ -264,12 +264,14 @@ struct XPTInterfaceDescriptor {
#define XPT_ID_SCRIPTABLE 0x80
#define XPT_ID_FUNCTION 0x40
#define XPT_ID_FLAGMASK 0xc0
#define XPT_ID_BUILTINCLASS 0x20
#define XPT_ID_FLAGMASK 0xe0
#define XPT_ID_TAGMASK (~XPT_ID_FLAGMASK)
#define XPT_ID_TAG(id) ((id).flags & XPT_ID_TAGMASK)
#define XPT_ID_IS_SCRIPTABLE(flags) (!!(flags & XPT_ID_SCRIPTABLE))
#define XPT_ID_IS_FUNCTION(flags) (!!(flags & XPT_ID_FUNCTION))
#define XPT_ID_IS_BUILTINCLASS(flags) (!!(flags & XPT_ID_BUILTINCLASS))
extern XPT_PUBLIC_API(PRBool)
XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,

View File

@ -845,7 +845,7 @@ class Interface(object):
def __init__(self, name, iid=UNRESOLVED_IID, namespace="",
resolved=False, parent=None, methods=[], constants=[],
scriptable=False, function=False):
scriptable=False, function=False, builtinclass=False):
self.resolved = resolved
#TODO: should validate IIDs!
self.iid = iid
@ -857,6 +857,7 @@ class Interface(object):
self.constants = list(constants)
self.scriptable = scriptable
self.function = function
self.builtinclass = builtinclass
# For sanity, if someone constructs an Interface and passes
# in methods or constants, then it's resolved.
if self.methods or self.constants:
@ -922,11 +923,13 @@ class Interface(object):
(flags, ) = struct.unpack(">B", map[start:start + struct.calcsize(">B")])
offset = offset + struct.calcsize(">B")
# only the first two bits are flags
flags &= 0xC0
flags &= 0xE0
if flags & 0x80:
self.scriptable = True
if flags & 0x40:
self.function = True
if flags & 0x20:
self.builtinclass = True
self.resolved = True
def write_directory_entry(self, file):
@ -965,6 +968,8 @@ class Interface(object):
flags |= 0x80
if self.function:
flags |= 0x40
if self.builtinclass:
flags |= 0x20
file.write(struct.pack(">B", flags))
def write_names(self, file, data_pool_offset):
@ -1260,7 +1265,9 @@ class Typelib(object):
i.parent.name))
out.write(""" Flags:
Scriptable: %s
BuiltinClass: %s
Function: %s\n""" % (i.scriptable and "TRUE" or "FALSE",
i.builtinclass and "TRUE" or "FALSE",
i.function and "TRUE" or "FALSE"))
out.write(" Methods:\n")
if len(i.methods) == 0: