<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/base/base.html">
<script>
'use strict';

tv.exportTo('tv.c.analysis', function() {
  function StubAnalysisTable() {
    this.ownerDocument_ = document;
    this.nodes_ = [];
  }

  StubAnalysisTable.prototype = {
    __proto__: Object.protoype,

    get ownerDocument() {
      return this.ownerDocument_;
    },

    appendChild: function(node) {
      if (node.tagName == 'TFOOT' || node.tagName == 'THEAD' ||
              node.tagName == 'TBODY') {
        node.__proto__ = StubAnalysisTable.prototype;
        node.nodes_ = [];
        this.ownerDocument_ = document;
      }
      this.nodes_.push(node);
    },

    get lastNode() {
      return this.nodes_.pop();
    },

    get nodeCount() {
      return this.nodes_.length;
    }
  };

  return {
    StubAnalysisTable: StubAnalysisTable
  };
});
</script>

<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/base/base.html">
<script>
'use strict';

tv.exportTo('tv.c.analysis', function() {
  function StubAnalysisTable() {
    this.ownerDocument_ = document;
    this.nodes_ = [];
  }

  StubAnalysisTable.prototype = {
    __proto__: Object.protoype,

    get ownerDocument() {
      return this.ownerDocument_;
    },

    appendChild: function(node) {
      if (node.tagName == 'TFOOT' || node.tagName == 'THEAD' ||
              node.tagName == 'TBODY') {
        node.__proto__ = StubAnalysisTable.prototype;
        node.nodes_ = [];
        node.ownerDocument_ = document;
      }
      this.nodes_.push(node);
    },

    get lastNode() {
      return this.nodes_.pop();
    },

    get nodeCount() {
      return this.nodes_.length;
    }
  };

  return {
    StubAnalysisTable: StubAnalysisTable
  };
});
</script>

Fix StubAnalysisTable.appendChild to work in canary
Fix StubAnalysisTable.appendChild to work in canary

In canary, __proto__ has become writable. This causes the appendChild hack
in StubAnalysisTable to actually work: it never actually did before, I think.
And, now that it works, tests fail because of a typo in the appendChild stub
where the parent's ownerDocument field is set instead of the nodes.
