Skip to content

Commit

Permalink
Revert "Prevent postmessage from trapping exceptions. Fixes #9"
Browse files Browse the repository at this point in the history
This reverts commit 74619a6.
  • Loading branch information
jonhoo committed Nov 10, 2011
1 parent 1989f6f commit c7deb35
Showing 1 changed file with 34 additions and 18 deletions.
52 changes: 34 additions & 18 deletions postmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,24 @@ var NO_JQUERY = {};
}
continue;
}
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:e.source, data:data, type:msg.callback});
}
try {
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:e.source, data:data, type:msg.callback});
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply, e);
} else {
sendReply ( o.fn(msg.data, e) );
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply, e);
} else {
sendReply ( o.fn(msg.data, e) );
catch (ex) {
if (msg.errback) {
// notify post message errback
pm.send({target:e.source, data:ex, type:msg.errback});
}
}
};
}
Expand Down Expand Up @@ -373,16 +381,24 @@ var NO_JQUERY = {};
continue;
}
}
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url});
}
try {
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url});
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply);
} else {
sendReply ( o.fn(msg.data) );
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply);
} else {
sendReply ( o.fn(msg.data) );
catch (ex) {
if (msg.errback) {
// notify post message errback
pm.send({target:source_window, data:ex, type:msg.errback, hash:true, url:hash.source.url});
}
}
};
}
Expand Down

0 comments on commit c7deb35

Please sign in to comment.