Opened 8 years ago

Last modified 7 years ago

#13943 review Bug

When custom config is missing, the default config gets loaded twice.

Reported by: Jakub Ś Owned by: kkrzton
Priority: Nice to have (we want to work on it) Milestone:
Component: General Version: 4.0
Keywords: Support. Cc:

Description

Steps to reproduce

  1. Put below code into your config.js (custom config file doesn't exist under given path)
    config.specialChars = config.specialChars.concat([['♂', 'Male']]);
    config.customConfig = '/abc/config.js';	
    
  2. Open Special Characters dialog

Expected result

One male symbol is visible.

Actual result

Two male symbols are visible.

Other details (browser, OS, CKEditor version, installed plugins)

Happens in all browsers. I have been able to reproduce this issue from CKEditor 4.0

This issue has been reported on our support channel.

Change History (15)

comment:1 Changed 8 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 8 years ago by kkrzton

Owner: set to kkrzton
Status: confirmedassigned

comment:3 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.7

comment:4 Changed 8 years ago by kkrzton

Every config file defines a function like

CKEDITOR.editorConfig = function( config ) { ... }

When config file is loaded, CKEDITOR.editorConfig function is executed (it is defined by recently loaded config so for every config the corresponding function is executed once).

In this case when custom config file fails to load, the CKEDITOR.editorConfig function is called anyway but due to loading failure it still is the function defined in default config. The CKEDITOR.editorConfig from default config with this code

config.specialChars = config.specialChars.concat([['♂', 'Male']]);

is executed twice and so male symbol is appended twice to specialCharcters.

comment:5 Changed 8 years ago by kkrzton

Status: assignedreview

Changes in t/13943.

Added checking if customConfig was successfully loaded and workaround for #14275 (check if CKEDITOR.editorConfig function changed after loading next script - if not it means script failed to load).

comment:6 Changed 8 years ago by Marek Lewandowski

Status: reviewreview_failed
  • Please add tests to editor.js test suite. And put a ticket number in the comment, e.g. like it's done here.
  • Instead of using multiple variables for counters, you could just use 2 counters and reset them in test suite setUp method
  • There is a problem that you rely on config implementation detail to make tests, e.g. in config1.js. Sometimes it's tough to avoid it - I know.

But in this particular case you couldn't you simply use two variables for the counters/boolean?

Let's say you create CKEDITOR._testCustom and CKEDITOR._timesExecuted. These variables are reset in test suite setUp method.

I see what was the reason why you used real config.js files at all, it's because your custom variables would not be modified/incremented otherwise. To solve this you could simply init one editor with:

bender.editor = {
	config: {
		customConfig: '%TEST_DIR%_assets/config.js'
	}
}

So this instance would be loaded firist and it will load existing config.js (which will increase CKEDITOR._testCustom in its callback).

  • 1.js - I'm not entirely sure what you mean by cyclic custom file here, could you drop a couple lines of comment?
  • I love the simplicity of initial solution, let's see if we can fix #14275 so fix for this ticket does not need to implement a workaround.

comment:7 Changed 8 years ago by kkrzton

Status: review_failedassigned

comment:8 Changed 8 years ago by kkrzton

Status: assignedreview

Changes in t/13943.

  • Tests simplified and moved to editor.js. Basically I think one test checking invalid custom config should be sufficient. As you suggested I adjusted this test and hope I didn't misunderstand you. If so let me know.
  • Thanks to #14275 fix, workaround is only needed for IE8.

comment:9 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.7CKEditor 4.5.8

comment:10 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.8CKEditor 4.5.9

comment:11 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.9CKEditor 4.5.10

comment:12 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.10CKEditor 4.5.11

Moving tickets to the next milestone.

comment:13 Changed 8 years ago by Marek Lewandowski

Milestone: CKEditor 4.5.11CKEditor 4.6.1

comment:14 Changed 7 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.1CKEditor 4.6.2

comment:15 Changed 7 years ago by Marek Lewandowski

Milestone: CKEditor 4.6.2
Priority: NormalNice to have (we want to work on it)

Moving to the nice to have list.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy