Adding basic checks for resource sizes, would appreciate your feedback!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1024 * 1024) {Can we define these limit numbers in a more visible place? We might actually need it for tests.
Might want to also include this size limit in CL description.
virtual void CheckGuardrailsPolicyForLargeAsset() {}Please add comments to describe what the function does. The name of the function doesn't really tell me what it does. Is there a better name?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
mojom::blink::DocumentPolicyFeature::kNetworkEfficiencyGuardrails,CheckGuardrailsPolicyForRequest is called before check for response.WasFetchedViaServiceWorker() - do we still want/need to report policy violation if it was SW/cache(?) or some other way to get image without going to the network?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1024 * 1024) {Can we define these limit numbers in a more visible place? We might actually need it for tests.
Might want to also include this size limit in CL description.
Moved them to frame_fetch_context.h
mojom::blink::DocumentPolicyFeature::kNetworkEfficiencyGuardrails,CheckGuardrailsPolicyForRequest is called before check for response.WasFetchedViaServiceWorker() - do we still want/need to report policy violation if it was SW/cache(?) or some other way to get image without going to the network?
This isn't in the doc currently, but given the purpose of the policy (to flag perf costs), I think it should only be reported when we actually hit the network. I've looked at ResourceLoader and my understanding is we'll currently intercept all responses so I'll add checks for network cases only.
virtual void CheckGuardrailsPolicyForLargeAsset() {}Please add comments to describe what the function does. The name of the function doesn't really tell me what it does. Is there a better name?
Renamed to CheckGuardrailsPolicyForAssetSize and added a comment in fetch_context.h
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
static constexpr size_t kGuardrailsLargeDataThreshold = 100 * 1024; // 100kBnit(?) I have seen Units added in the name of the const(kSlowDeserializationSizeThresholdBytes for example) - may consider adding it here, like kGuardrailsLargeDataThresholdBytes.
!response.NetworkAccessed()) {May be add comment, why `!response.NetworkAccessed()` check is not enough. Can it be that NetworkAccessed and WasCached will be both true?
bool expect_violation;add default value here
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Addressing feedback and adding last impl pieces.
static constexpr size_t kGuardrailsLargeDataThreshold = 100 * 1024; // 100kBnit(?) I have seen Units added in the name of the const(kSlowDeserializationSizeThresholdBytes for example) - may consider adding it here, like kGuardrailsLargeDataThresholdBytes.
Updated.
!response.NetworkAccessed()) {May be add comment, why `!response.NetworkAccessed()` check is not enough. Can it be that NetworkAccessed and WasCached will be both true?
Updated.
bool expect_violation;add default value here
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool is_enforced_policy =would has_enforced_policy a better name?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Adding resource size check to network-efficiency-guardrails Document Policy, per https://docs.google.com/document/d/1gS1p2poGx_zvUKeYg-py_fHGU-GVHmm75cQSZNGglig
masonf@ for execution_context/local_dom_window
toyoshim@ for loader
would has_enforced_policy a better name?
Renamed.
static constexpr size_t kGuardrailsLargeDataThreshold = 100 * 1024; // 100kBLuis Floresnit(?) I have seen Units added in the name of the const(kSlowDeserializationSizeThresholdBytes for example) - may consider adding it here, like kGuardrailsLargeDataThresholdBytes.
Updated.
Marked as resolved.
!response.NetworkAccessed()) {Luis FloresMay be add comment, why `!response.NetworkAccessed()` check is not enough. Can it be that NetworkAccessed and WasCached will be both true?
Updated.
Marked as resolved.
1024 * 1024) {Luis FloresCan we define these limit numbers in a more visible place? We might actually need it for tests.
Might want to also include this size limit in CL description.
Moved them to frame_fetch_context.h
Moved to local_dom_window.h, where they're used.
mojom::blink::DocumentPolicyFeature::kNetworkEfficiencyGuardrails,Luis FloresCheckGuardrailsPolicyForRequest is called before check for response.WasFetchedViaServiceWorker() - do we still want/need to report policy violation if it was SW/cache(?) or some other way to get image without going to the network?
This isn't in the doc currently, but given the purpose of the policy (to flag perf costs), I think it should only be reported when we actually hit the network. I've looked at ResourceLoader and my understanding is we'll currently intercept all responses so I'll add checks for network cases only.
Marked as resolved.
bool expect_violation;Luis Floresadd default value here
Added.
Marked as resolved.
virtual void CheckGuardrailsPolicyForLargeAsset() {}Luis FloresPlease add comments to describe what the function does. The name of the function doesn't really tell me what it does. Is there a better name?
Renamed to CheckGuardrailsPolicyForAssetSize and added a comment in fetch_context.h
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
execution_context/local_dom_window LGTM
// Make those const public for testing purpose.nit: `These are` rather than `Make those`
if (bytes < kGuardrailsLargeDataThresholdBytes) {`<=` ?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Make those const public for testing purpose.nit: `These are` rather than `Make those`
Updated.
if (bytes < kGuardrailsLargeDataThresholdBytes) {`<=` ?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Updated image threshold per discussion in https://docs.google.com/document/d/1RGxvtkoQbvApLVdipiASoUQjC0Jf-IKD9qV1EfUJHAQ/edit?disco=AAABxj9MH24
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
execution_context/local_dom_window still LGTM
// Make those const public for testing purpose.Luis Floresnit: `These are` rather than `Make those`
Updated.
Done
if (bytes < kGuardrailsLargeDataThresholdBytes) {Luis Flores`<=` ?
Updated and added tests at the boundary. Thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |