What javascript program will list all the native / host / platform objects that are provided "spontaneously" in a browser?
If no such program can be written is there any other way of generating such a list?
Clarification of "native / host / platform objects" as requested by this answer
Examples:
using
window.navigator.userAgent =
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3"
some native JavaScript objects (some of which happen to be constructors)
Array, Boolean, Date, Function, Number, Object. RegExp, String
Error, Iterator, JSON, Math
some DOM host objects
Image, Option
some other platform objects
Worker, XMLHttpRequest, XPCNativeWrapper
references:
- platform objects are defined in W3C WebIDL interface definition language specification
- W3C HTML 5 specification
- W3C DOM
- Mozilla JavaScript technologies overview
- Mozilla DOM
- Mozilla ECMAScript references
- ecma262-5.com
See also
- What are the predefined primitive constructors?
- List DOM Documents attributes and methods using Javascript
This is minimally effective:
javascript:
alert("using:\n"+window.navigator.userAgent);
list=[];
for( i in window) list.push(i);
alert("found:\n"+list.sort().join("\t"));
list=[];
for( i in window) list.push([typeof eval("window."+i),i].join("\t"));
alert(["found:",list.sort().join("\n--------------\n")].join("\n"))
produces
using:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3)
Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
found:
Components XPCNativeWrapper XPCSafeJSObjectWrapper addEventListener
alert applicationCache atob back blur btoa captureEvents
clearInterval clearTimeout close closed confirm content controllers
crypto defaultStatus directories disableExternalCapture dispatchEvent
document dump enableExternalCapture find focus forward
frameElement frames fullScreen getComputedStyle getInterface
getSelection globalStorage history home i innerHeight
innerWidth length list localStorage location locationbar
menubar moveBy moveTo mozInnerScreenX mozInnerScreenY name navigator
netscape open openDialog opener outerHeight outerWidth
pageXOffset pageYOffset parent personalbar pkcs11 postMessage
print prompt releaseEvents removeEventListener resizeBy
resizeTo routeEvent screen screenX screenY scroll scrollBy
scrollByLines scrollByPages scrollMaxX scrollMaxY scrollTo
scrollX scrollY scrollbars self sessionStorage setInterval
setResizable setTimeout showModalDialog sizeToContent status
statusbar stop toolbar top updateCommands window
and (selectively edited)
found:
...
--------------
function $
--------------
function PR_normalizedHtml
--------------
function XPCNativeWrapper
--------------
function XPCSafeJSObjectWrapper
--------------
...
--------------
object Components
--------------
object Markdown
--------------
object PR
--------------
object StackExchange
--------------
...
--------------
object jQuery15205241375142988156
--------------
...
--------------
object window
--------------
...