Skip to content

Commit

Permalink
Fix Audio test in IE (issue 272) and fix error when deleting block wi…
Browse files Browse the repository at this point in the history
…th warning.
  • Loading branch information
NeilFraser committed Aug 20, 2015
1 parent f3ea66a commit 96d5987
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
10 changes: 5 additions & 5 deletions blockly_compressed.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1252,8 +1252,10 @@ Blockly.BlockSvg.prototype.setWarningText = function(text, opt_id) {
// Wait until the drag finishes.
var thisBlock = this;
this.setWarningText.pid_[id] = setTimeout(function() {
delete thisBlock.setWarningText.pid_[id];
thisBlock.setWarningText(text, id);
if (thisBlock.workspace) { // Check block wasn't deleted.
delete thisBlock.setWarningText.pid_[id];
thisBlock.setWarningText(text, id);
}
}, 100);
return;
}
Expand Down
9 changes: 7 additions & 2 deletions core/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,17 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
* @private
*/
Blockly.WorkspaceSvg.prototype.loadAudio_ = function(filenames, name) {
if (!window['Audio'] || !filenames.length) {
if (!filenames.length) {
return;
}
try {
var audioTest = new window['Audio']();
} catch(e) {
// No browser support for Audio.
// IE can throw an error even if the Audio object exists.
return;
}
var sound;
var audioTest = new window['Audio']();
for (var i = 0; i < filenames.length; i++) {
var filename = filenames[i];
var ext = filename.match(/\.(\w+)$/);
Expand Down

0 comments on commit 96d5987

Please # to comment.