Workaround to get to JavaScript functions in Chrome in Bonfire?

Levi Ma November 21, 2011

Hello,

I created some JS functions in my app: e.g. 'document.getMyAppsBuildNumber()' returns the build number which we can populate via Bonfire's variables into a JIRA issue field.

That's the idea at least! But it's not working in Chrome. I do get a result from that call using IE9+Bonfire.

{quote} Chrome and Safari effectively run extension scripts in a sandbox, allowing access to the DOM but not global variables and functions{quote}

which is what I am experiencing in Bonfire + Chrome.

If I check http://code.google.com/chrome/extensions/content_scripts.html it seems there could be a workaround possible: have some shared place to set the answer in the application to the question asked by Bonfire. So a bit of indirect passing of variables.

But I guess that means that there is some development needed in the Bonfire for Chrome extension, as well as some extra coding in our application.

Or is there a workaround for such custom JS variables and functions?

2 answers

1 accepted

0 votes
Answer accepted
gdavidson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2011

At the moment there is no workaround other than the DOM access methods suggested by Google.

It does raise an interesting question of having a standardised access wrapper in Bonfire, so that you would only need to create hidden HTML elements in the right format, then access their contents in a variable with something like bonfire.meta[name].

I've raised a feature request at https://jira.atlassian.com/browse/BON-607 to address that issue.

0 votes
mikedavies December 11, 2011

Hey I think I might have something to fix your problem. You can perform synchronous AJAX requests with Bonfire and Chrome. So instead of a javascript method called getmyAppsBuildNumber(), you would have a web service/script sitting there waiting for requests.

You can read more about it on a blog post I made about this issue: http://mikemurko.com/general/ajax-variables-in-atlassian-bonfire-for-jira-to-access-session-state/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events