Skip to content

Commit

Permalink
Backed out changesets 6d72b823b67f and acdff324d588 (bug 907077) for …
Browse files Browse the repository at this point in the history
…ASAN debug jit-test failures.
  • Loading branch information
rvandermeulen committed Oct 1, 2013
1 parent 8189ee7 commit 18fe7ab
Show file tree
Hide file tree
Showing 106 changed files with 577 additions and 1,131 deletions.
17 changes: 8 additions & 9 deletions addon-sdk/source/lib/sdk/deprecated/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.metadata = {
};

const { Trait } = require('../deprecated/traits');
const { iteratorSymbol } = require('../util/iteration');

/**
* @see https://jetpack.mozillalabs.com/sdk/latest/docs/#module/api-utils/list
Expand Down Expand Up @@ -39,7 +38,7 @@ exports.Iterable = Iterable;
* elements of the list). List is a base trait and is meant to be a part of
* composition, since all of it's API is private except length property.
*/
const listOptions = {
const List = Trait.resolve({ toString: null }).compose({
_keyValueMap: null,
/**
* List constructor can take any number of element to populate itself.
Expand Down Expand Up @@ -115,12 +114,12 @@ const listOptions = {
for (let element of array)
yield onKeyValue ? [++i, element] : onKeys ? ++i : element;
},
};
listOptions[iteratorSymbol] = function* iterator() {
let array = this._keyValueMap.slice(0);
iterator: function iterator() {
let array = this._keyValueMap.slice(0);

for (let element of array)
yield element;
}
const List = Trait.resolve({ toString: null }).compose(listOptions);
for (let element of array)
yield element;
}

});
exports.List = List;
32 changes: 15 additions & 17 deletions addon-sdk/source/lib/sdk/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const { Ci, Cc } = require("chrome"),
{ getTabs, getTabContentWindow, getTabForContentWindow,
getAllTabContentWindows } = require('./tabs/utils'),
winUtils = require("./window/utils"),
events = require("./system/events"),
{ iteratorSymbol, forInIterator } = require("./util/iteration");
events = require("./system/events");

// The selection types
const HTML = 0x01,
Expand Down Expand Up @@ -100,26 +99,25 @@ const selectionListener = {
* is returned because the text field selection APIs doesn't support
* multiple selections.
*/
function* forOfIterator() {
let selection = getSelection(DOM);
let count = 0;
function iterator() {
let selection = getSelection(DOM);
let count = 0;

if (selection)
count = selection.rangeCount || (getElementWithSelection() ? 1 : 0);
if (selection)
count = selection.rangeCount || (getElementWithSelection() ? 1 : 0);

for (let i = 0; i < count; i++) {
let sel = Selection(i);
for (let i = 0; i < count; i++) {
let sel = Selection(i);

if (sel.text)
yield Selection(i);
}
if (sel.text)
yield Selection(i);
}
}

const selectionIteratorOptions = {
__iterator__: forInIterator
}
selectionIteratorOptions[iteratorSymbol] = forOfIterator;
const selectionIterator = obscure(selectionIteratorOptions);
const selectionIterator = obscure({
__iterator__: iterator, // for...in; for each...in
iterator: iterator // for....of
});

/**
* Returns the most recent focused window.
Expand Down
33 changes: 0 additions & 33 deletions addon-sdk/source/lib/sdk/util/iteration.js

This file was deleted.

16 changes: 9 additions & 7 deletions addon-sdk/source/lib/sdk/util/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ module.metadata = {

const { Class } = require('../core/heritage');
const listNS = require('../core/namespace').ns();
const { iteratorSymbol } = require('../util/iteration');

const listOptions = {
const List = Class({
/**
* List constructor can take any number of element to populate itself.
* @params {Object|String|Number} element
Expand Down Expand Up @@ -47,11 +46,14 @@ const listOptions = {
for each(let element in array)
yield onKeyValue ? [++i, element] : onKeys ? ++i : element;
},
};
listOptions[iteratorSymbol] = function iterator() {
return listNS(this).keyValueMap.slice(0)[iteratorSymbol]();
};
const List = Class(listOptions);
iterator: function iterator() {
let array = listNS(this).keyValueMap.slice(0),
i = -1;

for (let element of array)
yield element;
}
});
exports.List = List;

function addListItem(that, value) {
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/test_formelements.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
is(names[9], "something", "Entry 10")
is(names[10], "item", "Entry 11")
is(names[11], "namedItem", "Entry 12")
is(names[12], "@@iterator", "Entry 13")
is(names[12], "iterator", "Entry 13")
is(names[13], "length", "Entry 14")
</script>
</pre>
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/test_htmlcollection.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
is(names[8], "something", "Entry 9")
is(names[9], "item", "Entry 10")
is(names[10], "namedItem", "Entry 11")
is(names[11], "@@iterator", "Entry 12")
is(names[11], "iterator", "Entry 12")
is(names[12], "length", "Entry 13")
</script>
</pre>
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/test_rowscollection.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
is(names[10], "something", "Entry 11")
is(names[11], "item", "Entry 12")
is(names[12], "namedItem", "Entry 13")
is(names[13], "@@iterator", "Entry 14")
is(names[13], "iterator", "Entry 14")
is(names[14], "length", "Entry 15")
</script>
</pre>
Expand Down
4 changes: 2 additions & 2 deletions dom/bindings/Codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,9 +1514,9 @@ def allAncestorsAbstract(iface):

# FIXME Check for an existing iterator on the interface first.
if any(m.isGetter() and m.isIndexed() for m in methods):
self.regular.append({"name": "@@iterator",
self.regular.append({"name": 'iterator',
"methodInfo": False,
"selfHostedName": "ArrayIterator",
"nativeName": "JS_ArrayIterator",
"length": 0,
"flags": "JSPROP_ENUMERATE",
"condition": MemberCondition(None, None) })
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/parser/WebIDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def __init__(self, location, name, allowDoubleUnderscore = False,
[location])
if name[0] == '_' and not allowDoubleUnderscore:
name = name[1:]
if (name in ["constructor", "toString", "toJSON"] and
if (name in ["constructor", "iterator", "toString", "toJSON"] and
not allowForbidden):
raise WebIDLError("Cannot use reserved identifier '%s'" % (name),
[location])
Expand Down
8 changes: 8 additions & 0 deletions dom/bindings/test/test_forOf.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,20 @@
}
is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.childNodes)' should see elements added during iteration");

var iter1 = basket.childNodes.iterator();
var iter2 = basket.childNodes.iterator();
isnot(iter1, iter2, "nodelist.iterator() returns a new iterator each time");

log = '';
basket.appendChild(document.createTextNode("some text"));
for (var x of basket.children)
log += x.id + ";";
is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.children)' should iterate over child elements");

var iter1 = basket.children.iterator();
var iter2 = basket.children.iterator();
isnot(iter1, iter2, ".iterator() returns a new iterator each time");

var count = 0;
for (var x of document.getElementsByClassName("hazardous-materials"))
count++;
Expand Down
1 change: 0 additions & 1 deletion js/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ selfhosting_srcs := \
$(srcdir)/builtin/Date.js \
$(srcdir)/builtin/Intl.js \
$(srcdir)/builtin/IntlData.js \
$(srcdir)/builtin/Iterator.js \
$(srcdir)/builtin/Number.js \
$(srcdir)/builtin/ParallelArray.js \
$(srcdir)/builtin/String.js \
Expand Down
97 changes: 0 additions & 97 deletions js/src/builtin/Iterator.js

This file was deleted.

11 changes: 7 additions & 4 deletions js/src/builtin/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ function MapForEach(callbackfn, thisArg = undefined) {
/* Step 6-8. */
var entries = std_Map_iterator.call(M);
while (true) {
var result = std_Map_iterator_next.call(entries);
if (result.done)
break;
var entry = result.value;
try {
var entry = std_Map_iterator_next.call(entries);
} catch (err) {
if (err instanceof StopIteration)
break;
throw err;
}
callFunction(callbackfn, thisArg, entry[1], entry[0], M);
}
}
Loading

0 comments on commit 18fe7ab

Please sign in to comment.