Skip to content

Commit

Permalink
firefox: Throwing an error if the addon can't write to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Jun 15, 2015
1 parent 84a9b38 commit e81ad1d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions javascript/firefox-driver/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
goog.provide('fxdriver.files');
goog.provide('fxdriver.files.File');

goog.require('WebDriverError');
goog.require('bot.ErrorCode');

/**
* Creates a temporary text file starting with opt_prefix and ending with
* opt_suffix.
Expand Down Expand Up @@ -127,8 +130,11 @@ fxdriver.files.READ_MODE_ = 0x01;
fxdriver.files.File.prototype.append = function(toAppend) {
var ostream = Components.classes['@mozilla.org/network/file-output-stream;1']
.createInstance(Components.interfaces['nsIFileOutputStream']);
ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_,
parseInt('666', 8), 0);
try {
ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_, parseInt('666', 8), 0);
} catch (e) {
throw new WebDriverError(bot.ErrorCode.UNKNOWN_ERROR, e);
}

var converter =
Components.classes['@mozilla.org/intl/converter-output-stream;1']
Expand Down

0 comments on commit e81ad1d

Please sign in to comment.