Closed shravan2x closed 6 years ago
It actually uses character count by body.textContent.length
. With lot of multi-byte content this can differ from actual byte size.
In this place I prefer speed over accuracy.
In my case it was all ASCII data, should definitely have been < 128. But even a 7MB file continued to be formatted when the limit was set to 1MB. I'll try checking body.textContent.length
on that document and report back.
I just tried again. Using document.getElementsByTagName("body")[0].textContent.length;
gives me 7116555
. The Auto-format documents
option is set to under 1mb
, and it still formats the file.
The reason I felt it was using the content-length
is that it was 787564
, which is below 1mb.
good catch, somehow MB constants in code are 100x greater :p
The "Auto-format documents" currently seems to use the gzipped document size, which results in it trying to format large documents and fail with Chrome's OOM errors. Since a document could be compressed arbitrarily well, the extension should use the unzipped size instead for this option.