dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.09k stars 1.56k forks source link

getting webview contentWindow gives security error in chrome app and postMessage not working #19358

Closed DartBot closed 9 years ago

DartBot commented 10 years ago

This issue was originally filed by a.dumbri...@gmail.com


>What steps will reproduce the problem?

  1. Create chrome packaged application with DartEditor
  2. Add <webview> to html, insert some dart code with postMessage This is minimal working example to demonstrate the problem - https://github.com/Dumbris/dart_chrome_app_webview_security_error
  3. Build app
  4. Load unpacked extention into chrome browser

>What is the expected output? What do you see instead?

The application can't get webview contentWindow and execute postMessage on it. Error from chrome dev console: Uncaught SecurityError: Blocked a frame with origin "chrome-extension://bpddihniogcgmnlaghkacfagkecgnljo" from accessing a frame with origin "swappedout://". The frame requesting access has a protocol of "chrome-extension", the frame being accessed has a protocol of "swappedout". Protocols must match.

>What version of the product are you using? On what operating system? Google Chrome Version 36.0.1951.5 dev Dart version SDK 1.4.2, version 1.5.0-dev.4.2 - gives same error. Linux Ubuntu 14.04

>Please provide any additional information below. Link to SO question: http://stackoverflow.com/questions/24161380/how-to-postmessage-to-webview-in-dart-google-chrome-app-securityerror

kasperl commented 10 years ago

Added Area-ChromeApps, Triaged labels.