Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 11276031: FRP wrappers. "Update" menu item. (Closed)

Created:
Aug. 1, 2013, 2:29 a.m. by Oleksandr
Modified:
Aug. 13, 2013, 9:19 a.m.
Visibility:
Public.

Description

FRP wrappers. "Update" menu item.

Patch Set 1 #

Total comments: 2

Patch Set 2 : GetAppLocale is now retrieved directly from the browser. Get documentation link change. Manual Upda… #

Total comments: 18

Patch Set 3 : Comments addressed #

Total comments: 3

Patch Set 4 : Handle incorrect parameters for UpdateAvailable as an error #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M src/engine/Main.cpp View 1 2 3 1 chunk +1 line, -1 line 2 comments Download

Messages

Total messages: 12
Oleksandr
Aug. 1, 2013, 2:31 a.m. (2013-08-01 02:31:43 UTC) #1
Oleksandr
Aug. 5, 2013, 8:07 a.m. (2013-08-05 08:07:21 UTC) #2
Felix Dahlke
http://codereview.adblockplus.org/11276031/diff/3001/locales/en.ini File locales/en.ini (right): http://codereview.adblockplus.org/11276031/diff/3001/locales/en.ini#newcode13 locales/en.ini:13: install-question-title=Update Adblock Plus for Internet Explorer You made some ...
Aug. 6, 2013, 10:40 a.m. (2013-08-06 10:40:12 UTC) #3
Oleksandr
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode301 src/engine/main.cpp:301: updateAvailable = true; hm.. When would be the next ...
Aug. 8, 2013, 2:19 p.m. (2013-08-08 14:19:34 UTC) #4
Felix Dahlke
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode301 src/engine/main.cpp:301: updateAvailable = true; On 2013/08/08 14:19:34, Oleksandr wrote: > ...
Aug. 8, 2013, 2:29 p.m. (2013-08-08 14:29:54 UTC) #5
Oleksandr
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode301 src/engine/main.cpp:301: updateAvailable = true; It is empty in what I've ...
Aug. 8, 2013, 5:06 p.m. (2013-08-08 17:06:12 UTC) #6
Felix Dahlke
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode53 src/engine/main.cpp:53: MessageBox(NULL, upToDateText.c_str(), upToDateTitle.c_str(), MB_OK); On 2013/08/06 10:40:12, Felix H. ...
Aug. 9, 2013, 7:09 a.m. (2013-08-09 07:09:27 UTC) #7
Oleksandr
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode301 src/engine/main.cpp:301: updateAvailable = true; Hm. But it is set to ...
Aug. 9, 2013, 7:14 a.m. (2013-08-09 07:14:49 UTC) #8
Felix Dahlke
http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp File src/engine/main.cpp (right): http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newcode301 src/engine/main.cpp:301: updateAvailable = true; On 2013/08/09 07:14:49, Oleksandr wrote: > ...
Aug. 9, 2013, 7:18 a.m. (2013-08-09 07:18:41 UTC) #9
Oleksandr
http://codereview.adblockplus.org/11276031/diff/5014/src/engine/Main.cpp File src/engine/Main.cpp (right): http://codereview.adblockplus.org/11276031/diff/5014/src/engine/Main.cpp#newcode331 src/engine/Main.cpp:331: updateAvailable = true; Probably the most discussed line of ...
Aug. 9, 2013, 8:17 a.m. (2013-08-09 08:17:39 UTC) #10
Felix Dahlke
LGTM http://codereview.adblockplus.org/11276031/diff/5014/src/engine/Main.cpp File src/engine/Main.cpp (right): http://codereview.adblockplus.org/11276031/diff/5014/src/engine/Main.cpp#newcode331 src/engine/Main.cpp:331: updateAvailable = true; On 2013/08/09 08:17:39, Oleksandr wrote: ...
Aug. 9, 2013, 9:15 a.m. (2013-08-09 09:15:29 UTC) #11
Wladimir Palant
Aug. 13, 2013, 9:19 a.m. (2013-08-13 09:19:51 UTC) #12
It seems that Patch Set 3 didn't make it into the repository.

http://codereview.adblockplus.org/11276031/diff/1/html/static/js/ieFirstRun.js
File html/static/js/ieFirstRun.js (right):

http://codereview.adblockplus.org/11276031/diff/1/html/static/js/ieFirstRun.j...
html/static/js/ieFirstRun.js:49: Utils.appLocale = Settings.GetAppLocale();
This seems to assume that the result of require("prefs") is assigned to a global
Prefs variable where it can be accessed. Also, there is an assumption that this
result won't be used before the page load event.

I guess that the problem here is that the Settings object isn't available while
the page is loading? Then we cannot help the objects being uninitialized while
the page is being loaded. However, assuming global variables is completely
unnecessary. Please consider the following approach:

var AdblockPlus = (function()
{
  var scopes = {
    prefs: {
      Prefs: { documentation_link: "" }
    },
    ...
  };

  var result = {
    require: function(module)
    {
      return scopes[module];
    }
  };

  window.addEventListener("load", function()
  {
    result.getMessage = Settings.GetMessage;
    scopes.prefs.Prefs.documentation_link = Settings.GetDocumentationLink();
    ...
  }, false);

  return result;
})();

Wrapping everything inside a function ensures that only the AdblockPlus variable
is touched in the global scope - all other variables are defined locally and can
be accessed from that function only.

http://codereview.adblockplus.org/11276031/diff/1/src/shared/Communication.h
File src/shared/Communication.h (right):

http://codereview.adblockplus.org/11276031/diff/1/src/shared/Communication.h#...
src/shared/Communication.h:31: PROC_GET_APP_LOCALE,
This is no longer being used but hasn't been removed.

http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp
File src/engine/main.cpp (right):

http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newc...
src/engine/main.cpp:43: bool updateAvailable;
On 2013/08/06 10:40:12, Felix H. Dahlke wrote:
> I think you should explicitly initialise this to false, as with
> firstRunActionExecuted below, even though it's not necessary.

Not sure why but this variable is again not being initialized in the current
code.

http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newc...
src/engine/main.cpp:53: MessageBox(NULL, upToDateText.c_str(),
upToDateTitle.c_str(), MB_OK);
Please use MessageBoxW explicitly, you are using wstring as parameters.

http://codereview.adblockplus.org/11276031/diff/3001/src/engine/main.cpp#newc...
src/engine/main.cpp:60: MessageBox(NULL, errorText.c_str(), errorTitle.c_str(),
MB_OK);
Please use MessageBoxW explicitly, you are using wstring as parameters.

http://codereview.adblockplus.org/11276031/diff/3001/src/plugin/PluginClass.cpp
File src/plugin/PluginClass.cpp (right):

http://codereview.adblockplus.org/11276031/diff/3001/src/plugin/PluginClass.c...
src/plugin/PluginClass.cpp:1396: ctext = dictionary->Lookup("menu",
"menu-update");
What's the point of prefixing everything in the "menu" section with "menu-"?

http://codereview.adblockplus.org/11276031/diff/10001/src/engine/main.cpp
File src/engine/main.cpp (left):

http://codereview.adblockplus.org/11276031/diff/10001/src/engine/main.cpp#old...
src/engine/main.cpp:62: return;
This change isn't present in the current code.

http://codereview.adblockplus.org/11276031/diff/10001/src/engine/main.cpp
File src/engine/main.cpp (right):

http://codereview.adblockplus.org/11276031/diff/10001/src/engine/main.cpp#new...
src/engine/main.cpp:53: MessageBox(NULL, upToDateText.c_str(),
upToDateTitle.c_str(), MB_ICONINFORMATION);
Not sure why but this change isn't present in the current code. But I agree with
Felix, it should be MB_OK | MB_ICONINFORMATION.

http://codereview.adblockplus.org/11276031/diff/10001/src/engine/main.cpp#new...
src/engine/main.cpp:60: MessageBox(NULL, errorText.c_str(), errorTitle.c_str(),
MB_ICONEXCLAMATION);
Not sure why but this change isn't present in the current code. But I agree with
Felix, it should be MB_OK | MB_ICONEXCLAMATION.

Powered by Google App Engine
This is Rietveld