Closed Bug 908175 Opened 11 years ago Closed 11 years ago

[InputContext] Clearing inputcontext sets values to string "null" instead of NULL

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

x86
macOS
defect
Not set
normal

Tracking

(blocking-b2g:koi+, b2g-v1.2 fixed)

RESOLVED FIXED
blocking-b2g koi+
Tracking Status
b2g-v1.2 --- fixed

People

(Reporter: janjongboom, Assigned: janjongboom)

References

Details

(Whiteboard: QARegressExclude)

Attachments

(1 file)

If we invalidate the inputcontext in b2g then all DOMString values are set to "null" because in the webidl the types are specified as DOMString instead of DOMString?
Attached patch PatchSplinter Review
Assignee: nobody → janjongboom
Attachment #793987 - Flags: review?(kchen)
Blocks: 906096
Attachment #793987 - Flags: review?(khuey)
Attachment #793987 - Flags: review?(kchen)
Attachment #793987 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/8a35072c7cb8
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
These attributes should be empty string other than null, when the inputcontext is invalid. You shouldn't change the API interface.
Status: RESOLVED → REOPENED
Flags: needinfo?(janjongboom)
Resolution: FIXED → ---
Hmm, I didn't know the API requires the invalidated inputcontext to return empty string other than null. This should be added to the API document.
The API doesn't specify what the invalid inputcontext should return. The only requirement is that IME can't interact with the focused input field via invalid inputcontext.

It isn't necessary to set these attributes to null or empty string, but is a nice to have feature that will prevent IME using invalid inputcontext by mistake.

So I think we should not change the API as it is not necessary.
I don't agree. Empty string is something fundamentally different than NULL. F.e. code that relies on textBeforeCursor won't know whether the context was invalidated because `textBeforeCursor == ''`. It could be that there is no text. NULL is clear, as it's not a valid value for any of the fields.
Flags: needinfo?(janjongboom)
IME should not rely on checking the attributes of an inputcontext to know if the inputcontext is valid. It should listen to oninputcontextchange event and check mozInputMethod.inputcontext to ensure the inputcontext is valid and keep a valid reference.

Setting the attributes to null is merely a safeguard to prevent error. So I insist on not changing the API.
Then why even clear it at all? If we clear it, it should be to an invalid value.
It's fine for me not to clear these attribute if calling any method of an invalid inputcontext will return failure.
Status: REOPENED → RESOLVED
blocking-b2g: --- → koi?
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
blocking-b2g: koi? → koi+
Whiteboard: QARegressExclude
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: