mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1337899 - [marionette] - Fix construction of script src. r=ato
Marionette builds the final javascript source to execute by using the specified body, and wrapping it into an anonymouse function. Because all of this happens in a single line, a comment in the last line of the script body will cause the source only half-wise constructed, and the post-wrapping code assumed as comment too. MozReview-Commit-ID: CXtUKfr8jKO --HG-- extra : rebase_source : 8f5e7bce8cb2bcd2d32409212003f9369f2f5a30
This commit is contained in:
parent
b1ef7da4b4
commit
ad47be0ed3
@ -115,7 +115,9 @@ evaluate.sandbox = function(sb, script, args = [],
|
||||
src += `${ARGUMENTS}.push(rv => ${CALLBACK}(rv));`;
|
||||
}
|
||||
|
||||
src += `(function() { ${script} }).apply(null, ${ARGUMENTS})`;
|
||||
src += `(function() {
|
||||
${script}
|
||||
}).apply(null, ${ARGUMENTS})`;
|
||||
|
||||
// timeout and unload handlers
|
||||
scriptTimeoutID = setTimeout(timeoutHandler, timeout);
|
||||
|
@ -349,6 +349,9 @@ class TestExecuteContent(MarionetteTestCase):
|
||||
sandbox=None)
|
||||
self.assert_is_web_element(el)
|
||||
|
||||
def test_comment_in_last_line(self):
|
||||
self.marionette.execute_script(" // comment ")
|
||||
|
||||
@skip_if_mobile("Modal dialogs not supported in Fennec")
|
||||
def test_return_value_on_alert(self):
|
||||
res = self.marionette._send_message("WebDriver:ExecuteScript", {"script": "alert()"})
|
||||
|
Loading…
Reference in New Issue
Block a user