Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initial call of Joomla.loadOptions() #16488

Merged
merged 2 commits into from Jun 8, 2017

Conversation

Fedik
Copy link
Member

@Fedik Fedik commented Jun 3, 2017

Summary of Changes

This patch fix an initial call of Joomla.loadOptions() when page do not contain the Script options, which could lead to JavaScript error.

Testing Instructions

Use latest staging,
Add in to index.php of Isis template:

JHtml::_('behavior.core');
$this->addScriptDeclaration('
  try{Joomla.getOptions("blabla");alert("Works!");}catch(e){alert("Error!");};
');

And open "Control panel" page.

Expected result

You see alert "Works!"

Actual result

You see alert "Error!"

Documentation Changes Required

none

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 61b334a

works as described


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16488.

@andrepereiradasilva
Copy link
Contributor

@dgt41 (or other tester) please test since there another PRs waiting for this one to get merged
#16452 and #15529

@andrepereiradasilva
Copy link
Contributor

@Fedik i'm still getting the error. maybe there's another place you need to do that

@andrepereiradasilva
Copy link
Contributor

seems the error is here https://github.com/joomla/joomla-cms/blob/staging/media/system/js/core-uncompressed.js#L159

core.js?9398acd…:1 Uncaught TypeError: Cannot read property 'system.keepalive' of null at Object.Joomla.getOptions (core.js?9398acd…:1) at HTMLDocument.<anonymous> (keepalive.js?9398acd…:1) Joomla.getOptions @ core.js?9398acd…:1 (anonymous) @ keepalive.js?9398acd…:1

@C-Lodder
Copy link
Member

C-Lodder commented Jun 3, 2017

What happens if you do console.log(key); on the line you linked to in the comment above?

@andrepereiradasilva
Copy link
Contributor

console.log(key);
console.log(Joomla.optionsStorage);

results in

system.keepalive
null

@Fedik
Copy link
Member Author

Fedik commented Jun 3, 2017

I found the problem,
should be good now

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 9660d35


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16488.

1 similar comment
@Quy
Copy link
Contributor

Quy commented Jun 3, 2017

I have tested this item ✅ successfully on 9660d35


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16488.

@ghost
Copy link

ghost commented Jun 3, 2017

RTC after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 3, 2017
@wilsonge wilsonge merged commit c78df40 into joomla:staging Jun 8, 2017
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jun 8, 2017
@wilsonge wilsonge added this to the Joomla 3.7.3 milestone Jun 8, 2017
@Fedik Fedik deleted the fix-joomla-loadoptions branch June 10, 2017 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants