Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Find All Network-Hot JavaScript Objects
- var getOAPN=function getAllPropertyNames(obj){
- var la=0, lim=700, cu=obj, ALL=[];
- while(lim--&&cu&&(la!=cu)){ try{ ALL=ALL.concat(Object.getOwnPropertyNames(cu)); la=cu; if(typeof cu=='function') cu=cu.prototype; else cu=Object.getPrototypeOf(cu).prototype; }catch(e){ console.log("property name error, lim= "+lim,e); } }
- return ALL;
- };
- var ALL_defo=getOAPN(self);
- var NET_HOT=[], ee=[],
- //using the uri keyword causes problems
- net_hot_keywords=[/*"uri",*/"location","domain","origin","href","url","src"],
- net_ht_kwL=net_hot_keywords.length,
- str, nj=0, //set net j to 0
- ki, aw, c0, cn, //cn means current name
- ni=ALL_defo.length; //the net that says ni (ALL_defo index)
- while(ni){
- if(!nj){ ni--; nj=net_ht_kwL;
- try{ str="\n"+(getOAPN(c0=self[cn=ALL_defo[ni]]).join("\n").toLowerCase()); }catch(e){ ee.push(e); }
- /*try{ if(typeof c0=="function") str+="\n"+(getOAPN(c0.prototype).join("\n").toLowerCase()); }catch(e){ console.log(cn,e); } */
- }
- nj--;
- try{
- if( (ki=str.indexOf(net_hot_keywords[nj]))+1){
- aw=str.substring(str.lastIndexOf("\n",ki)+1,str.indexOf("\n",ki+1));
- if((!(net_hot_keywords[nj]=="src"||net_hot_keywords[nj]=="origin"))||net_hot_keywords[nj]==aw){
- NET_HOT.push({"name":cn, "keyword":net_hot_keywords[nj], "actual_word":aw });
- nj=0;
- }
- }
- }catch(e){ ee.push(e); }
- }
- //optional sort
- //NET_HOT.sort(function(a,b){ return a.name>b.name; });
- //note, still picking up some non-network-related objects, like navigator.geolocation
Add Comment
Please, Sign In to add comment