<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26137</bug_id>
          
          <creation_ts>2014-06-18 22:05:45 +0000</creation_ts>
          <short_desc>[WebDriver Spec]: Algorithm for serializing a result is broken</short_desc>
          <delta_ts>2016-12-13 20:27:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Browser Test/Tools WG</product>
          <component>WebDriver</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>20860</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="James Graham">james</reporter>
          <assigned_to name="Browser Testing and Tools WG">public-browser-tools-testing</assigned_to>
          <cc>barancev</cc>
    
    <cc>botalov.andrey</cc>
    
    <cc>lrekucki</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="Browser Testing and Tools WG">public-browser-tools-testing</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108036</commentid>
    <comment_count>0</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2014-06-18 22:05:45 +0000</bug_when>
    <thetext>In several ways:

It is defined in both executeScript and executeAsyncScript rather than in a single place

It seems to think that a javascript function is going to return an IDL type, which it isn&apos;t. This causes several problems:

  * DOMString is considered a possible return type, which it isn&apos;t, but a javascript string isn&apos;t, which it is

  * Similarly with long and Number

  * sequences of Nodes aren&apos;t a possible return type, although arrays in general are.

It seems like Document Element is apparently being used to mean &quot;Element&quot;, which is very unclear since a Document is not an Element.

Corresponding webelement needs to be a reference.

Arrays should probably be treated specially so that any array input results in an array output.

It is unclear how you are iterating over objects. Are only own properties considered, or do you flatten the prototype chain? ES will have an algorithm to hook into here.

The possibility of cyclic objects and indefinite recursion is not considered. You need to do something sensible in this case.

You might want to examine the algorithm at [1] which implements many of the same ideas.

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#safe-passing-of-structured-data</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108037</commentid>
    <comment_count>1</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2014-06-18 22:09:05 +0000</bug_when>
    <thetext>Oh and you need to consider the possibility that the algorithm throws because you can define a property like {get foo: function() {throw new TypeError()}}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108273</commentid>
    <comment_count>2</comment_count>
    <who name="Andrey Botalov">botalov.andrey</who>
    <bug_when>2014-06-24 14:00:31 +0000</bug_when>
    <thetext>WebIDL defines a mapping between WebIDL and Ecmascript - http://www.w3.org/TR/WebIDL/#es-type-mapping

DOMString seems to be nearly the same as a string in Ecmascript

Sequence seems to be nearly the same as array in Ecmascript

Notes:
1. I haven&apos;t read WebIDL spec fully so I don&apos;t know if it&apos;s more appropriate to use WebIDL types or Ecmascript&apos;s when saying how &quot;executeScript&quot; should work
2. Most of the spec uses WebIDL types so if it will be decided to use Ecmascript&apos;s types here it should be properly noted in the spec that types in this section (and only in this section) refer to Ecmascript&apos;s types, not WebIDL&apos;s.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108274</commentid>
    <comment_count>3</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2014-06-24 14:06:22 +0000</bug_when>
    <thetext>Using WebIDL only makes sense when describing interfaces. In this case there isn&apos;t an interface, there is just an algorithm that operates purely on JS types. Describing it in terms of WebIDL doesn&apos;t make any sense.

It is quite possible that there are other places in the spec using WebIDL for things that aren&apos;t interfaces. These uses are all wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108452</commentid>
    <comment_count>4</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2014-06-28 08:08:39 +0000</bug_when>
    <thetext>*** Bug 26228 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128319</commentid>
    <comment_count>5</comment_count>
    <who name="Alexei Barantsev">barancev</who>
    <bug_when>2016-12-13 20:27:36 +0000</bug_when>
    <thetext>And what is the resolution?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>