Bug 1513445 - Disallow web documents loaded with the SystemPrincipal
Diff Detail
- Repository
- rMOZILLACENTRAL mozilla-central
- Branch
- bug-1513445-assert-for-sub-and-document
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 39122 Build 50226: arc lint + arc unit
Event Timeline
Code analysis found 3 defects in this patch:
- 3 defects found by clang-format
You can run this analysis locally with:
- ./mach clang-format -p path/to/file.cpp (C/C++)
For your convenience, here is a patch that fixes all the clang-format defects: https://queue.taskcluster.net/v1/task/JWjxec5kSGi2cKE0TC4jHg/runs/0/artifacts/public/results/clang-format-PHID-DIFF-xlxy5qrfjz7jk5bbcj4q.diff (use it in your repository with hg import or git apply)
If you see a problem in this automated review, please report it here: https://bit.ly/2IyNRy2
| dom/security/nsContentSecurityManager.cpp | ||
|---|---|---|
| 797–798 ↗ | (On Diff #43478) | Warning: Incorrect coding style [clang-format] |
| 800–806 ↗ | (On Diff #43478) | Warning: Incorrect coding style [clang-format] |
| 808 ↗ | (On Diff #43478) | Warning: Incorrect coding style [clang-format] |
I don't understand what this patch is supposed to be doing. The comment talks about web documents, but then you check if the type is of TYPE_SCRIPT (twice)?
What do you want to assert? Or put differently, what should never happen here?
Code analysis found 3 defects in this patch:
- 3 defects found by clang-format
You can run this analysis locally with:
- ./mach clang-format -p path/to/file.cpp (C/C++)
For your convenience, here is a patch that fixes all the clang-format defects: https://queue.taskcluster.net/v1/task/DJoE6WEQQRSAjRdp3xawjg/runs/0/artifacts/public/results/clang-format-PHID-DIFF-j6nmsigd6l4obqjrrvz7.diff (use it in your repository with hg import or git apply)
If you see a problem in this automated review, please report it here: https://bit.ly/2IyNRy2
| dom/security/nsContentSecurityManager.cpp | ||
|---|---|---|
| 797–798 ↗ | (On Diff #43512) | Warning: Incorrect coding style [clang-format] |
| 800–806 ↗ | (On Diff #43512) | Warning: Incorrect coding style [clang-format] |
| 808 ↗ | (On Diff #43512) | Warning: Incorrect coding style [clang-format] |
| dom/security/nsContentSecurityManager.cpp | ||
|---|---|---|
| 808 ↗ | (On Diff #43512) | we should structure that in a better way:
While I think that could work for loads of type sub document, I am not so sure about type document loads because those don't have a valid loadingPrincipal, do they? |
Turn logical-and conditionals into nested ifs for improved readability.
Improved wording on assert message.
As discussed on slack, we should
- remove the isInAutomation bits
- check what the loadingPrincipal is in the top-level doc cases
- evaluate a TRY Push by things that are failing and see if we can/should fine grain the assertion, and then ultimately how we can annotate those tests
- finally, I guess we should ifdef the entire assertion and only run in debug builds
Once all that happened I am happy to review again!
adding carve-out to not break browser-mochitests.
changed ordering of if's to do most performance-sensitive checks last.
Please look at my previous suggestions, none of them seem to have it made into this version.
Now we are back to whitelisting everything which runs on TRY, no?
Also, please run ./mach clang-format before requesting r?
What we should do is, carve out only the tests we know will fail and then also have the assertion on when running TRY. Covering everything into |#ifdef DEBUG| is also important for this initial version of the assertion.
This moves the logic a bit around for performance (i.e., making most costly checks last)
and adds test.
Due to tooling problems, this revision had to be abandoned.
It has been superseded by https://phabricator.services.mozilla.com/D19351
| dom/security/nsContentSecurityManager.cpp | ||
|---|---|---|
| 808 ↗ | (On Diff #43512) |
|
Actually, https://phabricator.services.mozilla.com/D19350 is first - then https://phabricator.services.mozilla.com/D19351
sigh.