addon-sdk/source/lib/sdk/ui/frame/view.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <script>
     2 // HACK: This is not an ideal way to deliver chrome messages
     3 // to a innef frame content but seems only way that would
     4 // make `event.source` an this (outer frame) window.
     5 window.onmessage = function(event) {
     6   var frame = document.querySelector("iframe");
     7   var content = frame.contentWindow;
     8   // If message is posted from chrome it has no `event.source`.
     9   if (event.source === null)
    10     content.postMessage(event.data, "*");
    11 };
    12 // Hack: Ideally we would have used srcdoc on iframe, but in
    13 // that case origin of document is either content which is unable
    14 // to load add-on resources or a chrome to which add-on resource
    15 // can not send messages back.
    16 document.documentElement.style.overflow = "hidden";
    17 document.documentElement.innerHTML = atob(location.hash.substr(1));
    18 </script>

mercurial