From 91bb82fb7e7dd5b6c3633daa8382326992c5245d Mon Sep 17 00:00:00 2001
From: Brent Baker <brbaker@adobe.com>
Date: Fri, 7 Jun 2013 07:05:37 -0400
Subject: [PATCH] Bug 1548: Update results handling for Annex B section
 (r+bterlson)

---
 console/harness/helper.js         |  7 +++++--
 test/harness/helper.js            |  7 +++++--
 website/harness/helper.js         |  7 +++++--
 website/metadata/ecma-262-toc.xml | 14 ++++++++++++++
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/console/harness/helper.js b/console/harness/helper.js
index 04c6cb6b72..982400def8 100644
--- a/console/harness/helper.js
+++ b/console/harness/helper.js
@@ -259,9 +259,12 @@ function Presenter() {
         if(id == 0)
             return globalSection;
 
-        var match = id.match(/\d+/g);
+        var match = id.match(/\d+|[A-F](?=\.)/g);
         var section = globalSection;
 
+        if (match === null)
+            return section;
+
         for(var i = 0; i < match.length; i++) {
             if(typeof section.subsections[match[i]] !== "undefined") {
                 section = section.subsections[match[i]];
@@ -358,7 +361,7 @@ function Presenter() {
         for (var i = 0; i < nodes.length; i++) {
             if (nodes[i].nodeName === "sec") {
                 subsection = new Section(parentSection, nodes[i].getAttribute('id'), nodes[i].getAttribute('name'));
-                parentSection.subsections[subsection.id.match(/\d+$/)] = subsection;
+                parentSection.subsections[subsection.id.match(/\d+$|[A-F]$/)] = subsection;
                 addSectionsFromXML(nodes[i].childNodes, subsection);
             }
         }
diff --git a/test/harness/helper.js b/test/harness/helper.js
index 04c6cb6b72..982400def8 100644
--- a/test/harness/helper.js
+++ b/test/harness/helper.js
@@ -259,9 +259,12 @@ function Presenter() {
         if(id == 0)
             return globalSection;
 
-        var match = id.match(/\d+/g);
+        var match = id.match(/\d+|[A-F](?=\.)/g);
         var section = globalSection;
 
+        if (match === null)
+            return section;
+
         for(var i = 0; i < match.length; i++) {
             if(typeof section.subsections[match[i]] !== "undefined") {
                 section = section.subsections[match[i]];
@@ -358,7 +361,7 @@ function Presenter() {
         for (var i = 0; i < nodes.length; i++) {
             if (nodes[i].nodeName === "sec") {
                 subsection = new Section(parentSection, nodes[i].getAttribute('id'), nodes[i].getAttribute('name'));
-                parentSection.subsections[subsection.id.match(/\d+$/)] = subsection;
+                parentSection.subsections[subsection.id.match(/\d+$|[A-F]$/)] = subsection;
                 addSectionsFromXML(nodes[i].childNodes, subsection);
             }
         }
diff --git a/website/harness/helper.js b/website/harness/helper.js
index 04c6cb6b72..982400def8 100644
--- a/website/harness/helper.js
+++ b/website/harness/helper.js
@@ -259,9 +259,12 @@ function Presenter() {
         if(id == 0)
             return globalSection;
 
-        var match = id.match(/\d+/g);
+        var match = id.match(/\d+|[A-F](?=\.)/g);
         var section = globalSection;
 
+        if (match === null)
+            return section;
+
         for(var i = 0; i < match.length; i++) {
             if(typeof section.subsections[match[i]] !== "undefined") {
                 section = section.subsections[match[i]];
@@ -358,7 +361,7 @@ function Presenter() {
         for (var i = 0; i < nodes.length; i++) {
             if (nodes[i].nodeName === "sec") {
                 subsection = new Section(parentSection, nodes[i].getAttribute('id'), nodes[i].getAttribute('name'));
-                parentSection.subsections[subsection.id.match(/\d+$/)] = subsection;
+                parentSection.subsections[subsection.id.match(/\d+$|[A-F]$/)] = subsection;
                 addSectionsFromXML(nodes[i].childNodes, subsection);
             }
         }
diff --git a/website/metadata/ecma-262-toc.xml b/website/metadata/ecma-262-toc.xml
index 72c567eafc..bd9e990670 100644
--- a/website/metadata/ecma-262-toc.xml
+++ b/website/metadata/ecma-262-toc.xml
@@ -303,4 +303,18 @@
         <sec id="15.12.3" name="stringify ( value [ , replacer [ , space ] ] )"/>
       </sec>
   </sec>
+  <sec id="B" name="Annex B (informative) Compatibility">
+    <sec id="B.1" name="Additional Syntax">
+      <sec id="B.1.1" name="Numeric Literals"/>
+      <sec id="B.1.2" name="String Literals"/>
+    </sec>
+    <sec id="B.2" name="Additional Properties">
+      <sec id="B.2.1" name="escape"/>
+      <sec id="B.2.2" name="unescape"/>
+      <sec id="B.2.3" name="String.prototype.substr"/>
+      <sec id="B.2.4" name="Date.prototype.getYear"/>
+      <sec id="B.2.5" name="Date.prototype.setYear"/>
+      <sec id="B.2.6" name="Date.prototype.toGMTString"/>
+    </sec>
+  </sec>
  </esSpec>
\ No newline at end of file
-- 
GitLab