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

Fixed vertical slider check when obfuscated #1303

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@Cavitt
Contributor

Cavitt commented Jun 19, 2014

In #477, support for vertical slider computation was added.
The config check breaks when obfuscated, it ends up being something like if(a.j.Wd)

I've just started to familiarize myself with the code-base, but I believe this.options().vertical is the correct way to check an option. This should solve the obfuscation issue.

Fixed vertical slider check when obfuscated
In #477, support for vertical slider computation was added.
The config check breaks when obfuscated, it ends up being something like `if(a.j.Wd)`

I've just started to familiarize myself with the code-base, but I believe `this.options().vertical` is the correct way to check an option. This should solve the obfuscation issue.
@gkatsev

This comment has been minimized.

Show comment
Hide comment
@gkatsev

gkatsev Jun 19, 2014

Member

this.options() and this.options_ are equivalent within vjs itself. The correct fix is to actually make vertical a string.
Though, this seems to have been working alright in the players I've been working with.

Member

gkatsev commented Jun 19, 2014

this.options() and this.options_ are equivalent within vjs itself. The correct fix is to actually make vertical a string.
Though, this seems to have been working alright in the players I've been working with.

@Cavitt

This comment has been minimized.

Show comment
Hide comment
@Cavitt

Cavitt Jun 19, 2014

Contributor

The difference being vjs.Component.prototype.options is listed in the externs.

I see there are some instances in the code where code like this.options()['example'] are used.
Likewise, this.options().example is used very often as well. Without the above mentioned extern, the latter instances would break.

Ignoring the fact that it's breaking on obfuscation, this.options_ should not have been used outside of the Components class in the first place, it's supposed to be a private property.

Edit: changed the property to a string. Kept the options() call instead of accessing a private property.

Contributor

Cavitt commented Jun 19, 2014

The difference being vjs.Component.prototype.options is listed in the externs.

I see there are some instances in the code where code like this.options()['example'] are used.
Likewise, this.options().example is used very often as well. Without the above mentioned extern, the latter instances would break.

Ignoring the fact that it's breaking on obfuscation, this.options_ should not have been used outside of the Components class in the first place, it's supposed to be a private property.

Edit: changed the property to a string. Kept the options() call instead of accessing a private property.

@gkatsev

This comment has been minimized.

Show comment
Hide comment
@gkatsev

gkatsev Jun 19, 2014

Member

Well, it's supposed to be a internal to videojs, so, any videojs code can use it. Just don't use it outside (also, because it wont exist outside, you can't use it anyway).

But I guess this is fine too, since they are equivalent.

Also, thanks for the PR!

Member

gkatsev commented Jun 19, 2014

Well, it's supposed to be a internal to videojs, so, any videojs code can use it. Just don't use it outside (also, because it wont exist outside, you can't use it anyway).

But I guess this is fine too, since they are equivalent.

Also, thanks for the PR!

@heff heff added confirmed labels Jun 23, 2014

@heff

This comment has been minimized.

Show comment
Hide comment
@heff

heff Jun 23, 2014

Member

lgtm!

Member

heff commented Jun 23, 2014

lgtm!

@sethborg

This comment has been minimized.

Show comment
Hide comment
@sethborg

sethborg Jun 23, 2014

Contributor

There are a lot of places in the code where you could save 3 bytes by switching from array notation to dot notation. Here's one place where the two are intermixed. Although, apparently the minifying code fixes this anyway.

LINE 6146: vjs.TEST_VID['volume'] = 0.5;
LINE 6168: var volume = vjs.TEST_VID.volume;

Contributor

sethborg commented Jun 23, 2014

There are a lot of places in the code where you could save 3 bytes by switching from array notation to dot notation. Here's one place where the two are intermixed. Although, apparently the minifying code fixes this anyway.

LINE 6146: vjs.TEST_VID['volume'] = 0.5;
LINE 6168: var volume = vjs.TEST_VID.volume;

@heff

This comment has been minimized.

Show comment
Hide comment
@heff

heff Jun 23, 2014

Member

The array notation is necessary in some places where vars need to be external. Otherwise closure compiler aggressively mangles them. The volume example sneaks by because closure compiler has a default set of 'externs', the protect html-defined properties (including video element properties like volume) from getting mangled.

Member

heff commented Jun 23, 2014

The array notation is necessary in some places where vars need to be external. Otherwise closure compiler aggressively mangles them. The volume example sneaks by because closure compiler has a default set of 'externs', the protect html-defined properties (including video element properties like volume) from getting mangled.

@heff heff closed this in b66ef80 Jun 26, 2014

@heff

This comment has been minimized.

Show comment
Hide comment
@heff

heff Jun 26, 2014

Member

Thank you!

Member

heff commented Jun 26, 2014

Thank you!

@Cavitt Cavitt deleted the Cavitt:patch-1 branch Jun 26, 2014

@Cavitt

This comment has been minimized.

Show comment
Hide comment
@Cavitt

Cavitt Jun 26, 2014

Contributor

No problem.

Contributor

Cavitt commented Jun 26, 2014

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment