some folks say you can't.
here is a wise-guy workaround, but it's more of a joke than a real tool.
still, it might find a couple of surprises for you. window.dump? hehe
or it may hang your browser.
grab a sandwich check back later.
yes, it's a brute-force object detector. i'd never seen one before. this is just a proof of concept. i want a scalable distributed version.
Code:
var mystery=window; //"hello world" false [1,2,3]
var d1=+new Date;
r=[""];for(var i2=97; i2< 123;i2++){r.push(String.fromCharCode(i2));}
r[-1]="";
var s=r.join("");
var s0=0, s1=0, s2=0, s3=0, s4=0, s5=0, s6=0, s7=0, s8=0, n=27;
window.p={};
window.k6="";
window.k4="";
var k1, k2, k3, k5;
c=[0,0,0,0,0,0,0,0,0,0];
function runOne(){
var i=0, x;
for(s0=c[0];s0<n;++s0){
for(s1=c[1];s1<n;s1++){
for(s2=c[2];s2<n;s2++){
for(s3=c[3];s3<n;s3++){
if(i++>19){ c=[s0,s1?s1-1:0, s2?s2-1:0,s3?s3-1:0,0,0,0]; report(); return setTimeout(runOne, 750); }
for(s4=c[4];s4<n;s4++){ k4=r[s0]+r[s1]+r[s2]+r[s3]+r[s4];
for(s5=c[5];s5<n;s5++){ k5=k4+r[s5];
for(s6=c[6];s6<n;s6++){ k6=k5+r[s6];
if( (x=mystery[k6])!==undefined ) { p[k6]=String(x); }
}}}}}}}
var d2= +new Date;
console.log(document.title="done. found "+Object.keys(p).length +" properties in "+ (d2-d1)+"ms" );
}//end runOne()
function report(){
document.body.innerHTML="<pre>"+JSON.stringify(p, null, "\t");
}
runOne()
it misses anything with a number or uppercase letter. that slows it down even more...
after about 30 seconds, it had found this when run on this page using firebug:
Code:
{
"c": "0,0,0,0,0,0,0,0,0,0",
"i": "16",
"n": "27",
"p": "[object Object]",
"r": ",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",
"s": "abcdefghijklmnopqrstuvwxyz",
"ltr": "left",
"top": "[object Window]",
"who": "function who(A) {\n return openWindow(\"misc.php?\" + SESSIONURL + \"do=whoposted&t=\" + A, 230, 300);\n}",
"atob": "function atob() {\n [native code]\n}",
"back": "function back() {\n [native code]\n}",
"blur": "function blur() {\n [native code]\n}",
"btoa": "function btoa() {\n [native code]\n}",
"dump": "function dump() {\n [native code]\n}",
"eval": "function eval() {\n [native code]\n}",
"find": "function find() {\n [native code]\n}",
"gapi": "[object Object]",
"home": "function home() {\n [native code]\n}",
"java": "[Java Package \"java\"]",
"name": "",
"open": "function open() {\n [native code]\n}",
"self": "[object Window]",
"stop": "function stop() {\n [native code]\n}"
}
i wrote this just this weekend. this one is 7 chars, and the code got away from me, so it's a little sloppy. the 4 chars was fast and stable, but limited.
real answer: i think firebug is easier.