Bug 23250 - [Qt] NULL string should not be arbitrarily converted to empty string
Summary: [Qt] NULL string should not be arbitrarily converted to empty string
Status: RESOLVED DUPLICATE of bug 31863
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on: 31863
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-12 07:14 PST by Yael
Modified: 2014-04-24 16:44 PDT (History)
1 user (show)

See Also:


Attachments
change qt-runtime so it does not convert a null string to an empty string. (2.95 KB, patch)
2009-01-12 07:16 PST, Yael
vestbo: review-
Details | Formatted Diff | Diff
Return jsundefined instead of jsnull. (1.24 KB, patch)
2009-01-13 14:50 PST, Yael
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yael 2009-01-12 07:14:48 PST
When a QtWebKit based application returns a null string, it is converted to an empty string. From the JavaScript side, it is not possible to tell if the return value was an empty string or null.
Comment 1 Yael 2009-01-12 07:16:51 PST
Created attachment 26630 [details]
change qt-runtime so it does not convert a null string to an empty string.
Comment 2 Tor Arne Vestbø 2009-01-13 08:20:47 PST
Comment on attachment 26630 [details]
change qt-runtime so it does not convert a null string to an empty string.

> -    QCOMPARE(evalJS("myObject.stringProperty"), QString());
> +    QCOMPARE(evalJS("myObject.stringProperty"), sUndefined);

As discussed on IRC this behavior should apply to QVariants instead.

> +    if (variant.isNull() ) {
> +        if (type == QMetaType::QString)
> +            return jsUndefined();

So that if !variant.isValid() then return jsUndefined();

A default-constructed QVarant is not valid, i.e has the type set to QMetaType::Invalid
Comment 3 Yael 2009-01-13 14:50:22 PST
Created attachment 26684 [details]
Return jsundefined instead of jsnull.

This patch is not a solution to the bug, it was created to allow others to continue experimenting with the problem. In fact it breaks the test case evalJSV("myObject.myInvokableWithVariantArg(null)", type);
Comment 4 Jędrzej Nowacki 2009-11-26 01:50:17 PST
Closing as duplicate of bug 31863. Integration between QtWebKit - QtScript is a nicer and more generic solution.

If I'm wrong feel free to reopen the bug.

*** This bug has been marked as a duplicate of bug 31863 ***
Comment 5 Darin Adler 2014-04-24 16:44:55 PDT
Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.