Skip to content

Instantly share code, notes, and snippets.

View benjamn's full-sized avatar

Ben Newman benjamn

  • Apollo Graph, Inc (formerly: Meteor, Facebook/Instagram, Quora, Mozilla)
  • New York City
  • 07:52 (UTC -04:00)
View GitHub Profile
function empty() {}
empty.prototype = Date.prototype;
empty.prototype.constructor = Date;
var date = new empty,
rv = Date.call(date);
if (rv && typeof rv == "object")
date = rv;
console.log(date);
diff --git a/js/src/ipc/PJSObject.ipdl b/js/src/ipc/PJSObject.ipdl
--- a/js/src/ipc/PJSObject.ipdl
+++ b/js/src/ipc/PJSObject.ipdl
@@ -1,18 +1,29 @@
include protocol "PScriptProxy.ipdl";
-include "PScriptProxy.h"; // XXX why is this needed?
+include "mozilla/js/ipc/ScriptProxyTypes.h";
-using mozilla::js::ipc::JSVariant;
/*static*/ JSBool
JSObjectParent::JPW_GetProperty(JSContext *cx, JSObject *obj, jsval id,
jsval *vp)
{
printf("Calling JPW_GetProperty...\n"); fflush(0);
JSObjectParent* self = Unwrap(cx, obj);
if (!self)
return JS_FALSE;
Function.prototype.new_apply = function(args) {
var empty = function() {}, obj, rv;
empty.prototype = this.prototype; // 'this' is the constructor function, here
rv = this.apply(obj = new empty, args);
if (rv && typeof rv == "object")
return rv; // throw away the new object if the constructor returns a non-null object
return obj;
};
class test {
static boolean set_x(test t) {
return t.x = true;
}
static boolean get_x(test t) {
return t.x;
}
private boolean x = set_x(this) && get_x(this);
public static void main(String[] args) {
System.out.println(new test().x + "");
c++ -o debug_util.o -c -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES -DZLIB_INTERNAL -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux -DEXCLUDE_SKIA_DEPENDENCIES -DCHROMIUM_MOZILLA_BUILD -DOS_LINUX=1 -DOS_POSIX=1 -DHAVE_CONFIG_H -I/home/ben/dev/electrolysis/ipc/chromium/src -I/home/ben/dev/electrolysis/ipc/glue -I../../ipc/ipdl/_ipdlheaders -I/home/ben/dev/electrolysis/ipc/chromium/src/third_party/libevent -I/home/ben/dev/electrolysis/ipc/chromium/src/third_party/libevent/linux -I/home/ben/dev/electrolysis/ipc/chromium -I. -I../../dist/include -I../../dist/include/nsprpub -I/home/ben/dev/electrolysis/obj-ff-debug/dist/include/nspr -I/home/ben/dev/electrolysis/obj-ff-debug/dist/include/nss -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Wno-long-long -fno-strict-aliasing -pth
function temporary(accessor, value, body) {
var old_value = accessor(value);
try { return body(value, old_value) }
finally {
old_value = accessor(old_value);
if (old_value !== value)
throw [accessor, value, old_value];
}
}
class A
{
public:
typedef union {
int x, y;
char* s;
} UnionType;
UnionType u;
};
#define paste(x, y) x##y
#define blah(x) paste(blah, x)
int main()
{
int blahbar = 0;
return blah(FOO);
}
diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -920,17 +920,17 @@ nsHTMLDocument::StartDocumentLoad(const
"not nsICachingChannel");
rv = cacheDescriptor->SetMetaDataElement("charset",
charset.get());
NS_ASSERTION(NS_SUCCEEDED(rv),"cannot SetMetaDataElement");
}