Open Bug 583775 Opened 14 years ago Updated 2 years ago

Use HTMLWhitespace to trim whitespace for script event handlers attributes

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

People

(Reporter: mounir, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

IsHTMLWhitespace is checking for HTML5 whitespace which includes more characters  than IsAsciiSpace.
Very likely, TrimWhitespace<nsCRT::IsAsciiSpace> callers want to call TrimWhitespace<nsContentUtils::IsHTMLWhitespace>.
Whiteboard: [good first bug]
Might be a good time to make nsContentUtils::TrimCharsInSet consumers use
TrimWhitespace instead.
If you want to work on that, feel free to contact me on IRC (nick: volkmar) or by email.
Whiteboard: [good first bug] → [mentor=volkmar]
Assignee: nobody → chrisf
Attachment #537379 - Flags: review?(mounir.lamouri)
Comment on attachment 537379 [details] [diff] [review]
changed rellevent locations on for IsAscciSpace

Review of attachment 537379 [details] [diff] [review]:
-----------------------------------------------------------------

I agree with the changes you did but why didn't you change this call:
https://mxr.mozilla.org/mozilla-central/source/content/events/src/nsDOMDataTransfer.cpp#330

f=me for the moment. Please ask back for a review if you didn't change the call I pointed for good reasons or with a new patch.
Attachment #537379 - Flags: review?(mounir.lamouri) → feedback+
Changing the assignee given that we got a patch from someone else.
Chris, feel free to email me if you want to work on something else.
Assignee: chrisf → tsurdor
(In reply to comment #4)
> Comment on attachment 537379 [details] [diff] [review] [review]
> changed rellevent locations on for IsAscciSpace
> 
> Review of attachment 537379 [details] [diff] [review] [review]:
> -----------------------------------------------------------------
> 
> I agree with the changes you did but why didn't you change this call:
> https://mxr.mozilla.org/mozilla-central/source/content/events/src/
> nsDOMDataTransfer.cpp#330
> 
> f=me for the moment. Please ask back for a review if you didn't change the
> call I pointed for good reasons or with a new patch.

You can blame me for that one. Without a spec, I'd rather not change behaviour here.

Note that the change to ProcessViewportToken in nsContentUtils.cpp is wrong per <http://dev.w3.org/csswg/css-device-adapt/#parsing-algorithm>. The change in nsScriptLoader.cpp is correct.

In any case, this needs tests.
(In reply to comment #6)
> You can blame me for that one. Without a spec, I'd rather not change
> behaviour here.

If the spec say spacing characters should be trimmed, it will be HTML5 definition of spacing characters so we will have to change our code. IMO, it would be better to change this code now.

> Note that the change to ProcessViewportToken in nsContentUtils.cpp is wrong
> per <http://dev.w3.org/csswg/css-device-adapt/#parsing-algorithm>. The
> change in nsScriptLoader.cpp is correct.

Indeed :)

> In any case, this needs tests.

I agree.
Can you confirm that you're still working on this bug?
Flags: needinfo?(tsurdor)
Assignee: tsurdor → mounir
Attachment #537379 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #792736 - Flags: review?(Ms2ger)
Flags: needinfo?(tsurdor)
Whiteboard: [mentor=volkmar]
Flags: in-testsuite+
Summary: Change TrimWhitespace<nsCRT::IsAsciiSpace> calls to TrimWhitespace<nsContentUtils::IsHTMLWhitespace> if possible → Use HTMLWhitespace to trim whitespace for script event handlers attributes
Comment on attachment 792736 [details] [diff] [review]
Use HTMLWhitespace to trim script event handler attributes

Review of attachment 792736 [details] [diff] [review]:
-----------------------------------------------------------------

Missing a commit message. This *should* make us pass some imported tests; don't forget to update the expected failures.

::: content/html/content/test/test_script_event_handler.html
@@ +12,5 @@
> +    var executed = 0;
> +  </script>
> +  <script>
> +    executed++;
> +    ok(true, "should be executed");

The ok(true) ones aren't terribly useful. Fine either way.

@@ +65,5 @@
> +    executed++;
> +    ok(true, "should be executed");
> +  </script>
> +  <script>
> +    is(executed, 9, "should got 9 executions");

"should get", if you think that's useful
Attachment #792736 - Flags: review?(Ms2ger) → review+

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: mounir → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: