Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Blob type-string #12400

Merged
merged 1 commit into from Jul 18, 2016
Merged

Fix Blob type-string #12400

merged 1 commit into from Jul 18, 2016

Conversation

@izgzhen
Copy link
Contributor

izgzhen commented Jul 12, 2016

Use a final construction guard over type-string format; and other minor related cleanups

r? @Manishearth


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Jul 12, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/file.rs, components/script/dom/blob.rs
@highfive
Copy link

highfive commented Jul 12, 2016

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@Manishearth
Copy link
Member

Manishearth commented Jul 12, 2016

Can we start including tests with such PRs, now that it's testable (fine if you put the test in a later PR)

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jul 12, 2016

📌 Commit f24ddc0 has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jul 12, 2016

Testing commit f24ddc0 with merge a866ab8...

bors-servo added a commit that referenced this pull request Jul 12, 2016
Fix Blob type-string

Use a final construction guard over type-string format; and other minor related cleanups

r? @Manishearth
<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12400)
<!-- Reviewable:end -->
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 12, 2016

👌 Sure, I think I can activate Blob URL as soon as the #12406 is landed

@bors-servo
Copy link
Contributor

bors-servo commented Jul 12, 2016

💔 Test failed - mac-rel-wpt

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 12, 2016

Wow ... unexpected but nice to see the failures

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 12, 2016

From spec

type , of type DOMString, readonly
The ASCII-encoded string in lower case representing the media type of the Blob. On getting, user agents must return the type of a Blob as an ASCII-encoded string in lower case, such that when it is converted to a byte sequence, it is a parsable MIME type, or the empty string – 0 bytes – if the type cannot be determined.

Note: The type t of a Blob is considered a parsable MIME type if the ASCII-encoded string representing the Blob object’s type, when converted to a byte sequence, does not return undefined for the parse a MIME type algorithm.

Thus I doubt if the failed test cases are reasonable at all

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@Manishearth Comment on the failed tests?

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

This is sort of contradictory.

On one hand, when constructing the blob, the type has these restrictions:

If t contains any characters outside the range U+0020 to U+007E, then set t to the empty string and return from these substeps.

When getting the type, the condition that it is parseable is further introduced.

Firefox does not seem to impose either of these restrictions on it, a content type of text\x01/plain is also acceptable.

@sicking @annevk thoughts? This looks like a spec bug. The spec seems to assert that the following code:

a = new Blob([1,2,3], {type: "text/(plain"});
console.log(a.type) // prints text/(plain

shouldn't work. It does in Firefox, and the WPT tests /FileAPI/blob/Blob-constructor.html / /FileAPI/blob/Blob-slice.html rely on it

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

The latest upstream changes (presumably #12406) made this pull request unmergeable. Please resolve the merge conflicts.

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

Filed w3c/FileAPI#43

Feel free to mark those tests as expected failures and file a tracking issue.

(Or do the reverse, make the tests work, and file an issue)

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@Manishearth okay, thanks!

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

Since most browsers follow this behavior, it may make more sense to make the tests work.

@izgzhen izgzhen force-pushed the izgzhen:fix-type-string branch from f24ddc0 to 8985f37 Jul 13, 2016
@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

Trying commit 8985f37 with merge 06c25a0...

bors-servo added a commit that referenced this pull request Jul 13, 2016
Fix Blob type-string

Use a final construction guard over type-string format; and other minor related cleanups

r? @Manishearth
<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12400)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

💔 Test failed - arm64

@izgzhen
Copy link
Contributor Author

izgzhen commented Jul 13, 2016

@bors-servo retry

Looks like git problem

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

Trying commit 8985f37 with merge 11478f0...

bors-servo added a commit that referenced this pull request Jul 13, 2016
Fix Blob type-string

Use a final construction guard over type-string format; and other minor related cleanups

r? @Manishearth
<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12400)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2016

@sicking
Copy link

sicking commented Jul 13, 2016

Since I was pinged...

I think that in theory it would be nice to enforce that the .type is a "real" mimetype. However if browsers consistently don't do that, then it's probably not worth trying to add such a restriction.

Either way, filing a bug against the spec is likely the right thing to do.

@Manishearth
Copy link
Member

Manishearth commented Jul 13, 2016

@sicking thanks. Bug was filed at w3c/FileAPI#43. What are your thoughts on the issue of the character range in the constructor? Chrome and the spec agree, Firefox doesn't.

@sicking
Copy link

sicking commented Jul 13, 2016

If spec and Chrome agree, then we should change firefox to match both of those. But based on comments in that bug, Chrome doesn't seem to match the spec exactly either. But lets continue diescussion over in the other bug.

@Manishearth
Copy link
Member

Manishearth commented Jul 18, 2016

@bors-servo r+

r+ for now, we can update when we decide on the spec thing.

@bors-servo
Copy link
Contributor

bors-servo commented Jul 18, 2016

📌 Commit 8985f37 has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Jul 18, 2016

Testing commit 8985f37 with merge fa432a5...

bors-servo added a commit that referenced this pull request Jul 18, 2016
Fix Blob type-string

Use a final construction guard over type-string format; and other minor related cleanups

r? @Manishearth
<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12400)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 18, 2016

@bors-servo bors-servo merged commit 8985f37 into servo:master Jul 18, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.