How to get around the same origin policy violation for one local file for another?

I'm trying to poluvosstanovit Mozilla demonstration use + JavaScript <video>+ <canvas>files that are not located on the server.

Downloading my document causes the error console to report this error:

Error: uncaught exception: [Exception ... "Security error": 1000 "nsresult:" 0x805303e8 (NS_ERROR_DOM_SECURITY_ERR) "location:" file: /// media / disk / javascript / html5 / chromakey / chromakey1. htm Line: 23 "]

Here is line 23:

this.referenceImageData = this.bCtx.getImageData(0, 0, this.bufferCanvas.width, this.bufferCanvas.height);

He is trying to get image data from a canvas to which I previously copied a video frame, for example:

this.bCtx.drawImage(this.inputElement,
    0, 0,
    this.inputElement.width, this.inputElement.height,
    0, 0,
    this.bufferCanvas.width, this.bufferCanvas.height
);

Where this.inputElementrefers to this (rather boring) element:

<video id="MainInput" src="320x240.ogg" width="320" height="240"></video>

JAR?

, Firefox (https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript), , " t , .

+3
3

( , , /etc/passwd -, XMLHttpRequest iframe, - , - string <img> , javascript). . http://tools.ietf.org/html/draft-abarth-origin ( ", ", - )

- HTTP-.

, , Firefox , , , HTTP-... (YMMV)

+4

, , file:// .

.

+1

Firefox's origin policy for file access can be changed in "about: config". To exclude the same origin policy in the file: URI, change the "true" value of security.fileuri.strict_origin_policy to false. Mozilla about: config; origin_policy

0
source

Source: https://habr.com/ru/post/1711208/


All Articles