|
|
Chromium Code Reviews
DescriptionAllow loading MHTML archive from content scheme
BUG=630753
Committed: https://crrev.com/77ce66b313e37fd0bba77d3f85769e593c10a353
Cr-Commit-Position: refs/heads/master@{#415775}
Patch Set 1 #
Total comments: 6
Patch Set 2 : Address comments #
Total comments: 2
Patch Set 3 : Helper function and test #
Total comments: 2
Patch Set 4 : Move checks into a helper function #
Messages
Total messages: 31 (15 generated)
weiran@google.com changed reviewers: + jianli@chromium.org
weiran@google.com changed reviewers: + jianli@chromium.org
Hi Jian, This patch uses the same appraoch with your earlier CL, allowing content scheme in MHTML by adding a check. ptal Thanks.
Hi Jian, This patch uses the same appraoch with your earlier CL, allowing content scheme in MHTML by adding a check. ptal Thanks.
jianli@chromium.org changed reviewers: + lukasza@chromium.org
lukasza, please also approve this change for security perspective. https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:73: // The latter is now allowed due to full sandboxing enforcement on MHTML pages. Please also update comment. https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:74: if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.protocolIsInHTTPFamily() && !url.protocolIsContent()) The check for content protocol should only be for Android platform. https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/weborigin/KURL.h (right): https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/weborigin/KURL.h:140: bool protocolIsContent() const { return protocolIs("content"); } Probably no need to add a general check here since it is only used in one place.
On 2016/08/15 23:12:02, jianli wrote: > lukasza, please also approve this change for security perspective. > Allowing rendering of MHTML delivered via Android's content: protocol LGTM (for the same reasons why we recently allowed rendering of MHTML delivered via http: and https: - see https://codereview.chromium.org/2234543002/).
Comments addressed. ptal https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:73: // The latter is now allowed due to full sandboxing enforcement on MHTML pages. On 2016/08/15 23:12:02, jianli wrote: > Please also update comment. Done. https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:74: if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.protocolIsInHTTPFamily() && !url.protocolIsContent()) On 2016/08/15 23:12:02, jianli wrote: > The check for content protocol should only be for Android platform. Done. https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/weborigin/KURL.h (right): https://codereview.chromium.org/2247063002/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/weborigin/KURL.h:140: bool protocolIsContent() const { return protocolIs("content"); } On 2016/08/15 23:12:02, jianli wrote: > Probably no need to add a general check here since it is only used in one place. Done.
Also, don't forget to update the test MHTMLTest.cpp. https://codereview.chromium.org/2247063002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:75: #if (DE_OS == DE_OS_ANDROID) I don't think this is a correct check. You should use: #if OS(ANDROID) Also, we should try to avoid span this check in multi-line like this. I suggest to introduce a helper function like CanLoad to improve readability.
The CQ bit was checked by weiran@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Comment addressed. For test, I only added several lines in MHTMLFromScheme. Let me know if a test like EnforceSandboxFlags is also needed. https://codereview.chromium.org/2247063002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:75: #if (DE_OS == DE_OS_ANDROID) On 2016/08/17 01:12:49, jianli wrote: > I don't think this is a correct check. You should use: > #if OS(ANDROID) > > Also, we should try to avoid span this check in multi-line like this. I suggest > to introduce a helper function like CanLoad to improve readability. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2247063002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:74: if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.protocolIsInHTTPFamily() && !canLoadContent(url)) I think it would be better to move all these checks into a helper function, like: bool MHTMLArchive::canLoadArchive(onst KURL& url) { // MHTML pages can only be loaded ... if (SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) return true; if (url.protocolIsInHTTPFamily()) return true; #if OS(ANDROID) if (url.protocolIs("content")) return true; #endif return false; }
https://codereview.chromium.org/2247063002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp (right): https://codereview.chromium.org/2247063002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp:74: if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && !url.protocolIsInHTTPFamily() && !canLoadContent(url)) On 2016/08/17 20:27:21, jianli wrote: > I think it would be better to move all these checks into a helper function, > like: > bool MHTMLArchive::canLoadArchive(onst KURL& url) > { > // MHTML pages can only be loaded ... > if (SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) > return true; > if (url.protocolIsInHTTPFamily()) > return true; > #if OS(ANDROID) > if (url.protocolIs("content")) > return true; > #endif > return false; > } Done.
The CQ bit was checked by weiran@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
You should also ask platform owner, like esprehn@chromium.org , to approve this CL.
lgtm
weiran@google.com changed reviewers: + esprehn@chromium.org
esprehn@chromium.org: Ptal
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by jianli@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from lukasza@chromium.org Link to the patchset: https://codereview.chromium.org/2247063002/#ps60001 (title: "Move checks into a helper function")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Allow loading MHTML archive from content scheme BUG=630753 ========== to ========== Allow loading MHTML archive from content scheme BUG=630753 Committed: https://crrev.com/77ce66b313e37fd0bba77d3f85769e593c10a353 Cr-Commit-Position: refs/heads/master@{#415775} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/77ce66b313e37fd0bba77d3f85769e593c10a353 Cr-Commit-Position: refs/heads/master@{#415775} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
