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

Datatables format / Not loading on Safari: "TypeError: Attempting to configurable attribute of unconfigurable property..." #176

Closed
waandershz opened this issue Oct 12, 2016 · 22 comments
Labels

Comments

@waandershz
Copy link

waandershz commented Oct 12, 2016

We've a weird problem using the Datatables format wherein the used browser is Safari (tested with iPhone, iPad and Windows-version).

We have a very simple query:

{{#ask: [[Category:ZP Brief]]
| format=datatables
}}

Viewing the result with Chrome, Firefox, IE and Opera works fine, but when using Safari the browser continues endlessly say "Loading" showing no results, just a progress thing indication.

No difference for Vector- or Chameleon-skin.

The Safari console gives this error:

TypeError: Attempting to configurable attribute of unconfigurable property. load.php:156"

and when clicking

"load.php" "?No found, inserting dynamically.

If changing format to Broadtable format or Table format it also works fine in Safari.

Also see https://sourceforge.net/p/semediawiki/mailman/message/35365278/ and replies to that message.

@kghbln kghbln changed the title Problem using Datatables format and Safari Datatables format / Not loading on Safari: "TypeError: Attempting to configurable attribute of unconfigurable property..." Oct 12, 2016
@kghbln kghbln added the bug label Oct 12, 2016
@kghbln
Copy link
Member

kghbln commented Oct 12, 2016

Assuming you use MW 1.27.1, SMW 2.4.1 and SRF 2.3.0. Seems like Safari is degenerating to become another Internet Explorer. :(

@waandershz
Copy link
Author

Yep, MW 1.27.1, SMW 2.4.1 and SRF 2.3. Well, Safari is the default browser for Mac systems. So.

@s7eph4n
Copy link
Contributor

s7eph4n commented Oct 12, 2016

Safari is probably not the most commonly used browser among SRF devs, so if you could come up with more details, e.g. error messages, that would be very helpful. Does Safari have something like developer tools or a console?

@waandershz
Copy link
Author

Yes, the Safari console gives this error:

TypeError: Attempting to configurable attribute of unconfigurable property. load.php:156

and when clicking

"load.php" "?No found, inserting dynamically.

@hermannschwaerzlerUIBK
Copy link

Hi everyone,

I found a quick and dirty workaround:

--- resources/src/mediawiki/mediawiki.js.orig   2016-10-08 11:32:00.979515128 +0200
+++ resources/src/mediawiki/mediawiki.js        2016-10-12 22:38:55.970310197 +0200
@@ -97,13 +97,13 @@
         */
        function setGlobalMapValue( map, key, value ) {
                map.values[ key ] = value;
-               mw.log.deprecate(
-                               window,
-                               key,
-                               value,
-                               // Deprecation notice for mw.config globals (T58550, T72470)
-                               map === mw.config && 'Use mw.config instead.'
-               );
+               //mw.log.deprecate(
+               //              window,
+               //              key,
+               //              value,
+               //              // Deprecation notice for mw.config globals (T58550, T72470)
+               //              map === mw.config && 'Use mw.config instead.'
+               //);
        }

        Map.prototype = {

This works because Safari obviously can't handle (those defineProperty calls) in mw.log.deprecate defined in resources/src/mediawiki/mediawiki.js lines 631 ff.:

/**
 * Create a property in a host object that, when accessed, will produce
 * a deprecation warning in the console with backtrace.
 *
 * @param {Object} obj Host object of deprecated property
 * @param {string} key Name of property to create in `obj`
 * @param {Mixed} val The value this property should return when accessed
 * @param {string} [msg] Optional text to include in the deprecation message
 */
log.deprecate = !Object.defineProperty ? function ( obj, key, val ) {
        obj[ key ] = val;
} : function ( obj, key, val, msg ) {
        msg = 'Use of "' + key + '" is deprecated.' + ( msg ? ( ' ' + msg ) : '' );
        Object.defineProperty( obj, key, {
                configurable: true,
                enumerable: true,
                get: function () {
                        mw.track( 'mw.deprecate', key );
                        mw.log.warn( msg );
                        return val;
                },
                set: function ( newVal ) {
                        mw.track( 'mw.deprecate', key );
                        mw.log.warn( msg );
                        val = newVal;
                }
        } );

};

Unfortunately I have no idea how to solve this problem the right way.
Is it possible to avoid this call to mw.log.deprecate by changing SRF?

Greetings
Hermann

PS: @jethro: the test-URL I sent you earlier should work now after I fixed another unrelated problem with Safari (below 6 ?): It can't handle gzip compressed HTTP-responses even when the correspondig response header is set!

@waandershz
Copy link
Author

waandershz commented Oct 13, 2016

@hermannschwaerzlerUIBK Test-url works okay now (tested at iPhone + Safari):
foto 13-10-16 11 34 58

@mwjames
Copy link
Contributor

mwjames commented Oct 16, 2016

Unfortunately I have no idea how to solve this problem the right way.
Is it possible to avoid this call to mw.log.deprecate
This works because Safari obviously can't handle (those defineProperty calls) in mw.log.deprecate defined in resources/src/mediawiki/mediawiki.js lines 631 ff.:

Maybe asking someone like @Krinkle who might know whether mw.log.deprecate and the alleged defineProperty calls are causing issues on Safari.

@Krinkle
Copy link
Contributor

Krinkle commented Oct 17, 2016

Note that you can set $wgLegacyJavaScriptGlobals to false to disable this feature (without a patch).

This issue was fixed in the master (wikimedia/mediawiki@ae35d1d). See also T145570.

@kghbln kghbln added question and removed bug labels Oct 18, 2016
@kghbln
Copy link
Member

kghbln commented Oct 18, 2016

So this is a Safari 5.0 only and MW < 1.27 issue which was fixed in Safari 5.1 and MW 1.28. I guess $wgLegacyJavaScriptGlobals = false; is the way out here. Probably a backport to REL1_27 LTS could be done.

@Krinkle Thanks for the info.

@kghbln kghbln closed this as completed Oct 18, 2016
@kghbln
Copy link
Member

kghbln commented Oct 18, 2016

Documented on wiki

@waandershz
Copy link
Author

"So this is a Safari 5.0 only and MW < 1.27 issue". You mean "MW <= 1.27"? We use MW 1.27.1.

Also tested with Safari 5.1.7 (Windows) and Safari 7.0 (iPhone), same problem.

@kghbln
Copy link
Member

kghbln commented Oct 18, 2016

You mean "MW <= 1.27"?

Yeah, indeed. The mentioned code change explicitly mentions Safari 5 so I figured ... Thanks for clarifying. I just fluffed the docu.

@Krinkle Sounds like a backport to REL1_27 is a good idea?!

@waandershz
Copy link
Author

waandershz commented Oct 18, 2016

Okay, thanks.

And using $wgLegacyJavaScriptGlobals = false; has no side effects for MW or any extensions? As the manual page says "If this is set to false, old code using deprecated variables ... will no longer work".

@kghbln
Copy link
Member

kghbln commented Oct 18, 2016

has no side effects for MW or any extensions?

Dunno, just touch wood. Your wiki will tell.

@kghbln
Copy link
Member

kghbln commented Oct 27, 2016

This was backported to REL1_27 too. So MW 1.27.2 will include this too. Many thanks!

@waandershz
Copy link
Author

Can somebody re-open this issue? I think I can't do this a reporter of the issue.

@waandershz
Copy link
Author

waandershz commented Nov 10, 2016

$wgLegacyJavaScriptGlobals = false; turns out indeed to have side-effects: button https://www.mediawiki.org/wiki/Extension:Page_Forms/Defining_forms#Multiple-instance_templates doesn't work anymore, Console browser gives: Uncaught ReferenceError: sfgShowOnSelect is not defined. This is really a great problem in our wiki.

@kghbln
Copy link
Member

kghbln commented Nov 10, 2016

This was backported to REL1_27 too. So MW 1.27.2 will include this too. Many thanks!

Have you read this?

Uncaught ReferenceError: sfgShowOnSelect is not definedUncaught ReferenceError: sfgShowOnSelect is not defined

That looks like a Page Forms issue if I am not mistaken.

@waandershz
Copy link
Author

We use the current version (1.27.1) of MW and version 3.6 of Semantic Forms.

@kghbln
Copy link
Member

kghbln commented Nov 10, 2016

I guess we have to sit tight till Page Forms is fixed or 1.27.2 is released. What did Yaron say?

@waandershz
Copy link
Author

waandershz commented Nov 10, 2016

Using no $wgLegacyJavaScriptGlobals = false; gives Use of "sfgShowOnSelect" is deprecated. Use mw.config instead. but button form works anyway. So what's your suggestion?

@mwjames
Copy link
Contributor

mwjames commented Nov 12, 2016

Using no $wgLegacyJavaScriptGlobals = false; gives Use of "sfgShowOnSelect" is deprecated.

sfgShowOnSelect is not related to this extension (most likely SemanticForms) and in case the enabled wgLegacyJavaScriptGlobals causes issue with this settings then I would recommend to contact the maintainer of SF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants