Open Bug 1352465 Opened 7 years ago Updated 2 years ago

Getting permission denied contentwindow.document

Categories

(Firefox :: PDF Viewer, defect, P5)

52 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ffx, Unassigned)

Details

(Whiteboard: [pdfjs-integration])

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170323105023

Steps to reproduce:

HTML
------
<!doctype html><html><head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script src="http://www.example.com/path/y.js"></script>
</head><body onload="get_iframe()">
<iframe id="doc_frame" src="http://www.example.com/path/file.pdf"></iframe>
</body></html>

JAVASCRIPT FILE (y.js)
-------------------------
function get_iframe () {
    console.log(document.getElementById('doc_frame').contentWindow.document);
}



Actual results:

When trying to get the iframe document (from within the .js file), I get this permission error:

Error: Permission denied to access property "document"


Expected results:

I should be able to get the document.  All paths are identical (location of html file itself, src in iframe and js file).

This only happens in ff.
SecurityError: Permission denied to access property "document" on cross-origin object
Component: Untriaged → DOM: Security
Product: Firefox → Core
Component: DOM: Security → PDF Viewer
Product: Core → Firefox
Priority: -- → P5
Hi, I experience the same issue, is there any known workaround?

The error is now Uncaught DOMException: Permission denied to access property "document" on cross-origin object.

Whiteboard: [pdfjs-integration]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.