Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rsvp.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
rsvp.js
Commits
66aac64b
Commit
66aac64b
authored
Apr 22, 2013
by
Stefan Penner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly test and fix self fulfillment
parent
05e09ef3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
10 deletions
+23
-10
browser/rsvp.js
browser/rsvp.js
+4
-1
browser/rsvp.min.js
browser/rsvp.min.js
+1
-1
browser/rsvp/promise.amd.js
browser/rsvp/promise.amd.js
+4
-1
lib/rsvp/promise.js
lib/rsvp/promise.js
+4
-1
tests/extension-tests.js
tests/extension-tests.js
+10
-6
No files found.
browser/rsvp.js
View file @
66aac64b
...
...
@@ -479,7 +479,10 @@ define("rsvp/promise",
EventTarget
.
mixin
(
Promise
.
prototype
);
function
resolve
(
promise
,
value
)
{
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
if
(
promise
===
value
)
{
fulfill
(
promise
,
value
);
}
else
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
value
.
then
(
function
(
val
)
{
if
(
value
!==
val
)
{
resolve
(
promise
,
val
);
...
...
browser/rsvp.min.js
View file @
66aac64b
This diff is collapsed.
Click to expand it.
browser/rsvp/promise.amd.js
View file @
66aac64b
...
...
@@ -115,7 +115,10 @@ define(
EventTarget
.
mixin
(
Promise
.
prototype
);
function
resolve
(
promise
,
value
)
{
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
if
(
promise
===
value
)
{
fulfill
(
promise
,
value
);
}
else
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
value
.
then
(
function
(
val
)
{
if
(
value
!==
val
)
{
resolve
(
promise
,
val
);
...
...
lib/rsvp/promise.js
View file @
66aac64b
...
...
@@ -111,7 +111,10 @@ Promise.prototype = {
EventTarget
.
mixin
(
Promise
.
prototype
);
function
resolve
(
promise
,
value
)
{
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
if
(
promise
===
value
)
{
fulfill
(
promise
,
value
);
}
else
if
(
objectOrFunction
(
value
)
&&
isFunction
(
value
.
then
))
{
value
.
then
(
function
(
val
)
{
if
(
value
!==
val
)
{
resolve
(
promise
,
val
);
...
...
tests/extension-tests.js
View file @
66aac64b
...
...
@@ -3,21 +3,25 @@ describe("RSVP extensions", function() {
describe
(
"
self fulfillment
"
,
function
(){
it
(
"
treats self fulfillment as the recursive base case
"
,
function
(
done
){
var
aDefer
=
new
RSVP
.
defer
(),
bDefer
=
new
RSVP
.
defer
();
bDefer
=
new
RSVP
.
defer
(),
promiseA
=
aDefer
.
promise
,
promiseB
=
bDefer
.
promise
;
aDefer
.
promise
.
then
(
function
(
a
){
promiseA
.
then
(
function
(
a
){
setTimeout
(
function
(){
bDefer
.
resolve
(
bDefer
.
promise
);
bDefer
.
resolve
(
promiseB
);
},
1
);
return
bDefer
.
promise
;
return
promiseB
;
});
bDefer
.
promise
.
then
(
function
(
c
){
promiseB
.
then
(
function
(
c
){
done
();
})
aDefer
.
resolve
(
aDefer
.
promise
);
aDefer
.
resolve
(
promiseA
);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment