Loading editor/src/htmlimport.cpp +11 −15 Changes for editor/src/htmlimport.cpp: 11 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -1582,21 +1582,17 @@ bool blogi::htmlimport::convertHtmlToWidgetXml(const std::string &html, size_t totalCssBytes = 0; const int kMaxExternalScripts = 10; const size_t kMaxScriptBytes = 5 * 1024 * 1024; // Cumulative cap across ALL fetched scripts combined: unlike CSS, a // fetched external script's contents get inlined into the final page's // GlobalJs verbatim and executed as-is (see webedit_api.cpp's // handleImportHtml/renderTree) -- but it was written for the ORIGINAL // page's DOM, not blogi's widget-rendered version of it, so it's already // unlikely to do anything useful, and a large bundle (a full framework // runtime, analytics, etc.) only adds risk (uncaught errors breaking the // rest of the inlined script) and response size for no real benefit. // Confirmed against a real site: 9 external scripts (including a full // React build) totalling 2.7MB inlined this way correlated with preview/ // publish requests failing outright, likely from the resulting multi-MB // response tripping something size-related downstream -- so this is // capped much tighter than the per-script/stylesheet budgets above. const size_t kMaxTotalJsBytes = 300 * 1024; const size_t kMaxScriptBytes = 10 * 1024 * 1024; // Cumulative cap across ALL fetched scripts combined: a fetched external // script's contents get inlined into the final page's GlobalJs verbatim // and executed as-is (see webedit_api.cpp's handleImportHtml/renderTree). // A real site was found with 9 external scripts (including a full React // build) totalling 2.7MB inlined this way, which correlated with preview/ // publish requests failing outright -- root-caused to the render/response // path (see renderTree/sendJson and the HTTP/2 send path in libhttppp), // not this size on its own, so this is a generous budget, not a // conservative one -- large sites should work, not just small ones. const size_t kMaxTotalJsBytes = 10 * 1024 * 1024; int externalJsSeen = 0; std::string globalJs; Loading Loading
editor/src/htmlimport.cpp +11 −15 Changes for editor/src/htmlimport.cpp: 11 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -1582,21 +1582,17 @@ bool blogi::htmlimport::convertHtmlToWidgetXml(const std::string &html, size_t totalCssBytes = 0; const int kMaxExternalScripts = 10; const size_t kMaxScriptBytes = 5 * 1024 * 1024; // Cumulative cap across ALL fetched scripts combined: unlike CSS, a // fetched external script's contents get inlined into the final page's // GlobalJs verbatim and executed as-is (see webedit_api.cpp's // handleImportHtml/renderTree) -- but it was written for the ORIGINAL // page's DOM, not blogi's widget-rendered version of it, so it's already // unlikely to do anything useful, and a large bundle (a full framework // runtime, analytics, etc.) only adds risk (uncaught errors breaking the // rest of the inlined script) and response size for no real benefit. // Confirmed against a real site: 9 external scripts (including a full // React build) totalling 2.7MB inlined this way correlated with preview/ // publish requests failing outright, likely from the resulting multi-MB // response tripping something size-related downstream -- so this is // capped much tighter than the per-script/stylesheet budgets above. const size_t kMaxTotalJsBytes = 300 * 1024; const size_t kMaxScriptBytes = 10 * 1024 * 1024; // Cumulative cap across ALL fetched scripts combined: a fetched external // script's contents get inlined into the final page's GlobalJs verbatim // and executed as-is (see webedit_api.cpp's handleImportHtml/renderTree). // A real site was found with 9 external scripts (including a full React // build) totalling 2.7MB inlined this way, which correlated with preview/ // publish requests failing outright -- root-caused to the render/response // path (see renderTree/sendJson and the HTTP/2 send path in libhttppp), // not this size on its own, so this is a generous budget, not a // conservative one -- large sites should work, not just small ones. const size_t kMaxTotalJsBytes = 10 * 1024 * 1024; int externalJsSeen = 0; std::string globalJs; Loading