Bug 1423661 - Added data url to replace blob-download.html. r=whimboo

MozReview-Commit-ID: I5rsLqzia3w

--HG--
extra : rebase_source : ca896d82f60ea3cd92c4e476ad3c5c9bbcc6c32f
This commit is contained in:
Vedant Chakravadhanula 2018-01-26 01:43:11 +05:30
Родитель a4947c8ed5
Коммит 033f595342
2 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -5,12 +5,17 @@
from __future__ import absolute_import
import types
import urllib
from marionette_driver import By, errors, Wait
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
def inline(doc):
return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
@ -101,7 +106,17 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_window_handles_after_opening_new_non_browser_window(self):
def open_with_link():
self.marionette.navigate(self.marionette.absolute_url("blob_download.html"))
self.marionette.navigate(inline("""
<a id="blob-download" download="foo.html">Download</a>
<script>
const string = "test";
const blob = new Blob([string], { type: "text/html" });
const link = document.getElementById("blob-download");
link.href = URL.createObjectURL(blob);
</script>
"""))
link = self.marionette.find_element(By.ID, "blob-download")
link.click()

Просмотреть файл

@ -1,11 +0,0 @@
<!DOCTYPE html>
<a id="blob-download" download="foo.html">Download</a>
<script>
const string = "test";
const blob = new Blob([string], { type: "text/html" });
const link = document.getElementById("blob-download");
link.href = URL.createObjectURL(blob);
</script>