Permission denied to access property 'document' in firefox

1,706 views
Skip to first unread message

milu

unread,
Feb 15, 2012, 12:03:34 AM2/15/12
to Google Web Toolkit
Hi,
I am getting exception when i am running my app in development
mode .Please find exception details below

com.google.gwt.core.client.JavaScriptException: (Error): Permission
denied to access property 'document'
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
248)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
289)
at
com.google.gwt.dev.shell.ModuleSpace.displayErrorGlassPanel(ModuleSpace.java:
616)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:
401)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
200)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
525)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
at java.lang.Thread.run(Thread.java:619)

Anyone could help me to find the reason bind this error.I am facing
problem in firefox as well as ie8.

Waiting for reply......

Patrice De Saint Steban

unread,
Feb 15, 2012, 10:00:43 AM2/15/12
to google-we...@googlegroups.com
Do you use JSNI ?
In your JSNI, do you use the $doc name instead of document ?

milu

unread,
Feb 15, 2012, 11:59:39 PM2/15/12
to google-we...@googlegroups.com
Yes I am using JSNI in my project and using $doc .Is there any problem to use $doc ?
Please clarify this exception.

Thomas Broyer

unread,
Feb 16, 2012, 4:19:35 AM2/16/12
to google-we...@googlegroups.com
The error happens in loadModule, so your code hasn't yet been called (except possibly the onModuleLoad), or at least the error is not about $doc in JSNI, because the exception comes from displayErrorGlassPanel. This method tries to access the outer-most window object [1], and it's failing here most probably because of a Same-Origin Policy violation.
There are two possible causes to this:
  • your GWT app runs in a frame within a document from a different origin (e.g. GWT app loaded from server1.com in a frame of a document loaded from server2.net; it could also be as small a difference as www.server.com vs. server.com)
  • you're loading the HTML host page out of the file-system rather than served through HTTP (would be really strange for a DevMode session though)

Leon

unread,
Apr 2, 2014, 2:29:16 PM4/2/14
to google-we...@googlegroups.com
I used a frame to display https://www.yahoo.com from my Jetty Proxy Servlet. I can display this page in Frame, but once I run "((IFrameElement) element).getContentDocument()" in Java code and I got "Permission denied to access property 'document'" from a compiled cache.html. But I can use the same frame to display a file from same server like "http://127.0.0.1:82/Test.html. Once I run  "((IFrameElement) element).getContentDocument()" and I could get a Document value. I used Firebug to find the following html source like:

<iframe class="gwt-Frame gwt-TabLayoutPanelContent" src="http://127.0.0.1:82/Test.html" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">


<iframe class="gwt-Frame gwt-TabLayoutPanelContent" src="http://127.0.0.1:82/proxy?https://www.yahoo.com/" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">


I don't kown what is wrong. They seem to be from the same origin source. May Jetty Proxy Servlet not work as expected?

This project is due in two days. Please help out of this issue.

Many thanks,

Leon
Reply all
Reply to author
Forward
0 new messages