mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Backed out changeset 4079bc8d46ca (bug 1719124) for causing failures on printcmd.py. CLOSED TREE
This commit is contained in:
parent
9c94fc9c4c
commit
d8ab847244
@ -2912,20 +2912,9 @@ GeckoDriver.prototype.print = async function(cmd) {
|
||||
}
|
||||
|
||||
// Each UCS2 character has an upper byte of 0 and a lower byte matching
|
||||
// the binary data. Splitting the file into chunks to avoid hitting the
|
||||
// internal argument length limit.
|
||||
const chunks = [];
|
||||
// This is the largest power of 2 smaller than MAX_ARGS_LENGTH defined in Spidermonkey
|
||||
const argLengthLimit = 262144;
|
||||
|
||||
for (let offset = 0; offset < bytes.length; offset += argLengthLimit) {
|
||||
const chunkData = bytes.subarray(offset, offset + argLengthLimit);
|
||||
|
||||
chunks.push(String.fromCharCode.apply(null, chunkData));
|
||||
}
|
||||
|
||||
// the binary data
|
||||
return {
|
||||
value: btoa(chunks.join("")),
|
||||
value: btoa(String.fromCharCode.apply(null, bytes)),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -41,50 +41,6 @@ def test_html_document(session, inline):
|
||||
# TODO: Test that the output is reasonable
|
||||
assert_pdf(pdf)
|
||||
|
||||
def test_large_html_document(session, inline):
|
||||
session.url = inline("<div id=\"root\"></div>")
|
||||
|
||||
session.execute_script(
|
||||
"""
|
||||
const root = document.getElementById("root");
|
||||
|
||||
const width = 400;
|
||||
const height = 600;
|
||||
const rects = [];
|
||||
|
||||
for (let x = 0; x < width; ++x) {
|
||||
for (let y = 0; y < height; ++y) {
|
||||
const colourHex = Math.floor(Math.random() * 0xffffff).toString(16);
|
||||
|
||||
rects.push(`<rect x="${x}" y="${y}" width="1" height="1" fill="#${colourHex}" />`);
|
||||
}
|
||||
}
|
||||
|
||||
const svg = `
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 ${width} ${height}"
|
||||
width="${width}"
|
||||
height="${height}"
|
||||
>
|
||||
${rects.join("")}
|
||||
</svg>
|
||||
`;
|
||||
|
||||
root.insertAdjacentHTML("beforeend", svg);
|
||||
"""
|
||||
)
|
||||
|
||||
response = do_print(session, {})
|
||||
value = assert_success(response)
|
||||
pdf = decodebytes(value.encode())
|
||||
|
||||
# This was added to test the fix for a bug in firefox where a PDF larger
|
||||
# than 500kb would cause an error. If the resulting PDF is smaller than that
|
||||
# it could pass incorrectly.
|
||||
assert len(pdf) > 500000
|
||||
assert_pdf(pdf)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("options", [{"orientation": 0},
|
||||
{"orientation": "foo"},
|
||||
|
Loading…
Reference in New Issue
Block a user